UNPKG

is-sorted-g

Version:

A small module to check if an Array is sorted, study from dcousens/is-sorted

16 lines (13 loc) 353 B
const sorted = require('../') const fixtures = require('./fixtures') const tape = require('tape') const comparators = { descending (a, b) { return b - a } } fixtures.forEach(f => { tape(`returns ${f.expected} for ${f.array}`, t => { t.plan(1) let actual = sorted(f.array, comparators[f.comparator]) t.equal(actual, f.expected) }) })