1.0.0 • Published 6 years ago

shortest-first v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

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 their length 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']