Skip to content

forivall/heapfind

Repository files navigation

heapfind

Efficient sorted find function, using a heap to efficiently sort until a match is found.

build status dependency status coverage status npm version bundle size

Installation

npm install --save heapfind

Usage

import heapfind from 'heapfind';

const firstFoo = heapfind(
  [
    { index: 3, name: 'foo' },
    { index: 1, name: 'bar' },
    { index: 2, name: 'foo' },
  ],
  (a, b) => a.index - b.index,
  ({ name }) => name === 'foo'
);

Credits

Emily Marigold Klassen

License

ISC

Releases

No releases published

Packages

No packages published