dcousens / is-sorted

A small module to check if an Array is sorted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is-sorted

NPM js-standard-style

A small module to check if an Array is sorted.

Example

const sorted = require('is-sorted')

console.log(sorted([1, 2, 3]))
// => true

console.log(sorted([3, 1, 2]))
// => false

// supports custom comparators
console.log(sorted([3, 2, 1], function (a, b) { return b - a }))
// => true

LICENSE MIT

About

A small module to check if an Array is sorted

License:MIT License


Languages

Language:JavaScript 100.0%