length-sort
Sort an array of strings by length
Last updated 7 years ago by kevva .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install length-sort 
SYNC missed versions from official npm registry.

length-sort Build Status

Sort an array of strings by length

Install

$ npm install length-sort

Usage

const lengthSort = require('length-sort');

['ab', 'a', 1234, 'abc'].sort(lengthSort.asc);
//=> ['a', 'ab', 'abc', 1234]

['ab', 'a', 1234, 'abc'].sort(lengthSort.desc);
//=> [1234, 'abc', 'ab', 'a']

API

lengthSort.asc

Ascending sort.

lengthSort.desc

Descending sort.

License

MIT © Kevin Mårtensson

Current Tags

  • 2.0.0                                ...           latest (7 years ago)

2 Versions

  • 2.0.0                                ...           7 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE