1.0.0 • Published 6 years ago
shortest-first v1.0.0
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']
1.0.0
6 years ago