reZach / grammarify

Grammarify is a npm package that safely cleans up text that has mispellings, improper capitalization, lexical illusions, among other things.
MIT License
67 stars 10 forks source link

Moderate refactor, add unit tests, fix several bugs, create module configuration #7

Closed Vectorrent closed 2 years ago

Vectorrent commented 2 years ago
  1. Added a configuration object to the Grammarify instance, so that we may update disconnected/shorthand lists without needing to update the package itself. Documented this object in the readme.
  2. Added an option to disable spellchecking. Spellcheck is automatically disabled while running in a browser. Thus, this package is no longer Node-specific.
  3. Addresses some faults in the ellipsis handling. Documented the changes inline.
  4. Created a suite of very basic unit tests in Jest, to test each of one the features listed in the readme. Spellcheck doesn't work in Jest, but it does in Node, as it always has.
  5. Converted the deprecated array.substr() method to array.substring().
  6. Converted all vars to let and const.

This was more of a challenge than I expected it to be! This project is a little confusing, but very much appreciated. Thanks for keeping it maintained for us!

Ink

Vectorrent commented 2 years ago

Aaand... I just noticed that ES6 import isn't working. Give me a day or two to get that one fixed.

Vectorrent commented 2 years ago

False alarm! You can merge this, if you want it. It was just a caching issue.

The ES6 syntax is:

import Grammarify from 'grammarify'
const grammarify = new Grammarify({opts})
Vectorrent commented 2 years ago

Still not working in Node, as an ES6 module. The browser compiler was smart enough to fix the other issues.

Going to close this PR for now. I'll open another one if I can get this stuff working better.

reZach commented 2 years ago

Thanks @LuciferianInk for your partial work here. I've pushed a release with these changes.

Some of the methods in here, ie unstretchify and fixStretching definitely are a bit to unwind! Thanks for working through and your input on this project.