shortest-first
v1.0.0
Published
Sorts items in ascending order of length.
Downloads
4
Maintainers
Readme
shortest-first
Sorts items in ascending order of length.
Installation
Requires Node.js 6.0.0 or above.
npm i shortest-first
API
The module exports a single function.
- Parameter:
items
(iterable): Values that should be sorted by theirlength
property. (The original iterable is not modified.) - Return Value: Array
Example
const shortestFirst = require('shortest-first')
shortestFirst(['example', 'test']) // ['test', 'example']
// Supports the bind operator
['example', 'test']::shortestFirst() // ['test', 'example']