Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
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 11,815,629 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.