1.0.0 • Published 6 years ago
longest-first v1.0.0
longest-first
Sorts items in descending order of length.
Installation
Requires Node.js 6.0.0 or above.
npm i longest-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 longestFirst = require('longest-first')
longestFirst(['one', 'two', 'three']) // ['three', 'one', 'two']
// Supports the bind operator
['test', 'example']::longestFirst() // ['example', 'test']
1.0.0
6 years ago