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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    35,153
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    35,153

Package Sidebar

Install

npm i find-insert-index

Weekly Downloads

35,153

Version

0.0.1

License

MIT

Last publish

Collaborators

  • jnuno