
Product
Introducing Repository Labels and Security Policies
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
misspellings
Advanced tools
JavaScript module to serve the list of common misspellings from Wikipedia: Lists of common misspellings.
npm install --save misspellings
var misspellings = require("misspellings");
// Dictionary access
var dict = misspellings.dict();
console.log(dict["adress"]); // => "address"
console.log(dict["boaut"]); // => "bout,boat,about" (comma-separated string)
console.log(dict["Amercia"]); // => "America"
console.log(dict["amercia"]); // => undefined
// Lower-case dictionary
var lcDict = misspellings.dict({ lowerCase: true });
console.log(lcDict["Amercia"]); // => undefined
console.log(lcDict["amercia"]); // => "America"
// Get correct words for misspelling word
console.log(misspellings.correctWordsFor("adress"));
// => ["address"] (Always returns an array)
console.log(misspellings.correctWordsFor("boaut"));
// => ["bout", "boat", "about"]
console.log(misspellings.correctWordsFor("non-exist"));
// => []
console.log(misspellings.correctWordsFor("Amercia"));
// => ["America"]
console.log(misspellings.correctWordsFor("amercia"));
// => ["America"] (Case-insensitive by default)
console.log(misspellings.correctWordsFor("amercia", { caseSensitive: true }));
// => []
// Correct all misspellings in a string
console.log(misspellings.correct("mispelling is mispelled"));
// => "misspelling is misspelled"
console.log(misspellings.correct("Mispelling is Mispelled"));
// => "Misspelling is Misspelled" (case-insensitive and preserves cases by default)
console.log(misspellings.correct("Mispelling is mispelled", { caseSensitive: true }));
// => "Mispelling is misspelled"
console.log(misspellings.correct("Mispelling is Mispelled", { overrideCases: true }));
// => "misspelling is misspelled"
// RegExp to search misspellings
var re = misspellings.regexp("g");
// ...or...
var re = new RegExp(misspellings.pattern(), "g");
console.log("mispelling is mispelled".match(re));
// => ["mispelling", "mispelled"]
$ npm install
$ npm run build
And Babel-translated source files go into lib
directory.
To update documents and dictionaries, run:
$ npm run update
$ npm test
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
This software is licensed under GNU GPLv3. See LICENSE for full text of the license.
This software is using Wikipedia: Lists of common misspellings, which is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License, as a source of misspelling list.
The CC BY-SA 3.0 license says that the derived work also should be licensed under CC BY-SA. However, Creative Commons officially says it is not recommended to apply Creative Commons license to software.
Therefore, I decided to license this software under GPLv3 which is one-way compatible with CC BY-SA 4.0, and CC BY-SA 3.0 is compatible with CC BY-SA 4.0.
FAQs
List of common misspellings from Wikipedia
The npm package misspellings receives a total of 6,138 weekly downloads. As such, misspellings popularity was classified as popular.
We found that misspellings 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.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
Research
Security News
Socket researchers uncovered malicious npm and PyPI packages that steal crypto wallet credentials using Google Analytics and Telegram for exfiltration.
Product
Socket now supports .NET, bringing supply chain security and SBOM accuracy to NuGet and MSBuild-powered C# projects.