is-sorted
Version:
A small module to check if an Array is sorted
26 lines (17 loc) • 664 B
Markdown
# is-sorted
[](http://travis-ci.org/dcousens/is-sorted)
[](https://www.npmjs.org/package/is-sorted)
[](https://github.com/feross/standard)
A small module to check if an Array is sorted.
## Example
``` javascript
var 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](LICENSE)