Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
propose
Advanced tools
Readme
Propse a word when the input word is not in the dictionary
This module can be used to propse the right command in the scenario when there is a typo or mis-spell in the command line, it looks up the given dictionary and identifies the most similar word. It can also be used in any case that the string is formed by one or a series of known words, for example URL, directory path etc.
var propose = require('propose');
var dictionary = ['hello', 'world'];
var word = 'hallo';
propose(word, dictionary); //hello
threshold
[0~1] specifies only the word with similarity equals to or higher than that value will be returned
var propose = require('propose');
var dictionary = ['aaaaaaaa', 'baabbbb', 'ccccc'];
var word = 'ab';
propose(word, dictionary, {
threshold: 0.5
}); // null as the most similar word does not meet the threshold value
ignoreCase
[true, false] specifies whether ignore case when comparing two words
var propose = require('propose');
var dictionary = ['HELLO', 'hallo'];
var word = 'hello';
propose(word, dictionary, {
ignoreCase: true
}); //'HELLO'
Make sure mocha
is installed globally
npm install mocha -g
Run npm test
to run unit test
levenshtein-edit-distance
MIT
FAQs
Propse a word when the input word is not in the dictionary
The npm package propose receives a total of 37,006 weekly downloads. As such, propose popularity was classified as popular.
We found that propose 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.