Like ruby's abbrev module, but in js

npm install abbrev
38 035 downloads in the last day
181 731 downloads in the last week
773 306 downloads in the last month


Just like ruby's Abbrev.


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.

npm loves you