abbrev-js

Just like ruby’s Abbrev.

Usage:

  1. var abbrev = require("abbrev");
  2. abbrev("foo", "fool", "folding", "flop");
  3. // returns:
  4. { fl: 'flop'
  5. , flo: 'flop'
  6. , flop: 'flop'
  7. , fol: 'folding'
  8. , fold: 'folding'
  9. , foldi: 'folding'
  10. , foldin: 'folding'
  11. , folding: 'folding'
  12. , foo: 'foo'
  13. , fool: 'fool'
  14. }

This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.