npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

find-insert-index

0.0.1 • Public • Published

find-insert-index

Find the index to insert an element in array keeping the sort order.

Build Status

Example

var findInsertIndex, comparatorFn;
findInsertIndex = require('find-insert-index');
comparatorFn = function (a, b) {
  return a.id - b.id;
};

findInsertIndex(comparatorFn, [{id: 7}, {id: 8}], {id: 7});
// 1

Keywords

none

install

npm i find-insert-index

Downloadsweekly downloads

4,521

version

0.0.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability