
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
star-correct
Advanced tools
A small javascript library to automatically correct typos in messages based on the next message.
star-correct does automatic typo correction in the browser, based on the next message.
starjs.correct(['Fixing typos awsf never asier', 'easier* was*'])
// 'Fixing typos was never easier'
A small javascript npm library to automatically correct typos in messages based on the next message, and it works out of the box--no dependencies.
var starjs = require('star-correct');
starjs.correct(['I would like to to that today sometime', 'to do']);
// 'I would like to do that today sometime'
Not all messages are corrections. Star.js knows when something isn't a correction, even though it is passed in as a correction.
var starjs = require('star-correct');
starjs.correct(['I like apples', 'I like oranges, pecans, and strawberries, too.']);
// false (no correction needed)
Star.js is meant to replace manual spell checkers, or drop down menus that let you choose a different word. Spell checkers are very good if you have the time, but if you only have one correction to make, they're a bit overkill, especially when you have to use the mouse. All of these examples follow the same syntax as the previous boilerplate example.
starjs.correct(['I like apples', 'I like oranges, pecans, and strawberries, too.']);
// false (no correction needed)
starjs.correct(['She wanted to go to the movies', 'he*']);
// 'He wanted to go to the movies'
starjs.correct(['He went to the concert yesterday', 'a few days ago* was going to go*']);
// 'He was going to go to the concert a few days ago'
starjs.correct(['He go to store tomorrow', 'will*']);
// 'He will go to the store tomorrow'
starjs.correct(['Turn left on Main Street, then take a right on 123 Sesame Street', 'turn right*']);
// 'Turn right on Main Street, then take a right on 123 Sesame Street
starjs.correct(['I have 10 apples and one bananas', '2*']);
// 'I have 10 apples and two bananas'
starjs.correct(['The ayoxk bepwn dpx kimped ovwe the laxy soh', 'quick**']);
// 'The quick bepwn dpx kimped ovwe the laxy soh'
Star doesn't try to correct every single word; it knows the correct spelling of the word that you meant to type, and compares it against the words that you did type. Here's a comparison of a general spell checker against Star:
Super-bad-misspelled-sentence: The ayoxk bepwn dpx kimped ovwe the laxy soh
Correction I want to make: quick*
Star.js: ayoxk -> quick (correctly identifies misspelled word)
Conventional spell checker suggestions: aux, askoa, Axons, ataxic... (and no suggestion for "quick"!)
This is because spell checkers put heavy emphasis on the first letter of the word being correct, which is not always the case. They also use prouncination cues to determine whether a word is spelled correctly.
Star.js doesn't use prouncination, and it doesn't focus tonnes on the first letter: it looks at keys that are close to the letter that you may be trying to type--and a few other things--to determine whether the correction should correct that word. Each misspelled word is given a ranking on how likely it could have been created by looking at the keys which are closer to each letter on the keyboard, along with calculating a modified version of the levenshtein distance, and the highest ranking word is automatically corrected, if it is not a perfect match.
A demo is available at https://decagon.github.io/star.js/ (thanks to @njt1982 for getting the demo working nicely)
Just install node with apt-get install node, create a new project with npm init and just include star.js via var starjs = require('star-correct'); and you're good to go! See the examples section to see how to get started.
I have only tested Star.js in Google Chrome, but it should work with all modern browsers, except possibly IE, since it uses a string function which is not built-in to IE.
FAQs
A small javascript library to automatically correct typos in messages based on the next message.
We found that star-correct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.