Socket
Book a DemoInstallSign in
Socket

length-sort

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

length-sort

Sort an array of strings by length

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

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

Keywords

array

FAQs

Package last updated on 03 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts