Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
The abbrev npm package is used to create a list of unique abbreviations for a given set of strings. It is particularly useful when you need to generate a minimal set of distinct abbreviations for a list of words, ensuring that each word's abbreviation is unambiguous.
Generating abbreviations
This feature allows you to generate an object where the keys are all possible unique abbreviations and the values are the full strings that they map to. In the code sample, abbreviations for 'apple', 'ape', and 'april' are generated, resulting in an object with keys like 'a', 'ap', 'app', etc., each pointing to their respective full words.
const abbrev = require('abbrev');
const abbreviations = abbrev('apple', 'ape', 'april');
console.log(abbreviations);
Fuzzyset.js is a package that provides fuzzy string matching. It can be used to find strings that approximate other strings but does not generate abbreviations. It is more complex and suitable for cases where you want to match user input against a list of strings and find the closest match.
This package is used to find how similar two strings are or to find the best match in an array of strings. Unlike abbrev, it does not create abbreviations but rather compares strings for similarity, which can be useful in search algorithms and typo correction.
Just like ruby's Abbrev.
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
3.0.0 (2024-09-24)
abbrev
now supports node ^18.17.0 || >=20.5.0
9d4e497
#97 enable auto publish (#97) (@reggi)b4c7e46
#93 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])faa9bf1
#92 run template-oss-apply (@hashtagchris)ff93548
#80 bump @npmcli/template-oss to 4.22.0 (@lukekarrys)2369d5d
#95 postinstall for dependabot template-oss PR (@hashtagchris)090138a
#95 bump @npmcli/template-oss from 4.22.0 to 4.23.3 (@dependabot[bot])FAQs
Like ruby's abbrev module, but in js
The npm package abbrev receives a total of 24,476,773 weekly downloads. As such, abbrev popularity was classified as popular.
We found that abbrev demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.