Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
How similar are these two strings?
npm:
npm install similarity
var similarity = require('similarity')
similarity('food', 'food') // 1
similarity('food', 'fool') // 0.75
similarity('ding', 'plow') // 0
similarity('chicken', 'chick') // 0.714285714
similarity('ES6-Shim', 'es6 shim') // 0.875 (case insensitive)
similarity('ES6-Shim', 'es6 shim', {sensitive: true}) // 0.5 (case sensitive)
similarity(left, right[, options])
Get the similarity (number
) between two values (string
s),
where 0
is dissimilar, and 1
is equal.
options.sensitive
(boolean
, default: false
)
— Turn on (true
) to treat casing differences as differencesUsage: similarity [options] <word> <word>
How similar are these two strings?
Options:
-h, --help output usage information
-v, --version output version number
-s, --sensitive be sensitive to casing differences
Usage:
# output similarity
$ similarity sitting kitten
0.5714285714285714
$ similarity saturday sunday
0.625
Note: This module uses Levenshtein distance to measure similarity, but there are many other algorithms for string comparison. Here are a few:
clj-fuzzy
— Handy collection of algorithms dealing with fuzzy strings and phoneticsnatural
— General natural language facilities for nodestring-similarity
— Finds degree of similarity between two strings, based on Dice’s
coefficientdice-coefficient
— Sørensen–Dice coefficientjaro-winkler
— The Jaro-Winkler distance metricFAQs
How similar are these two strings?
The npm package similarity receives a total of 82,534 weekly downloads. As such, similarity popularity was classified as popular.
We found that similarity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.