Socket
Socket
Sign inDemoInstall

abbrev

Package Overview
Dependencies
0
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abbrev

Like ruby's abbrev module, but in js


Version published
Weekly downloads
25M
increased by2.53%
Maintainers
5
Install size
4.71 kB
Created
Weekly downloads
 

Package description

What is abbrev?

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.

What are abbrev's main functionalities?

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);

Other packages similar to abbrev

Readme

Source

abbrev-js

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.

FAQs

Last updated on 01 Nov 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc