JSPM

sorted-intersect

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 94
  • Score
    100M100P100Q76876F
  • License MIT

Intersect sorted lists using merge intersection with galloping lookahead

Package Exports

  • sorted-intersect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sorted-intersect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sorted-intersect

Intersect sorted lists using merge intersection with galloping lookahead.

npm install sorted-intersect

This is useful if you want to (effiently) intersect large sorted lists.

Usage

It is easy to use

var intersect = require('sorted-intersect');

var intersection = intersect([
    [4,6,7,8,9,10], // these lists should be sorted
    [6,7,8,10],
    [7,8,10],
    [4,5,6,7,8,9,10,11,12]
]);

console.log(intersection); // prints [7,8,10]

intersect(lists, options) takes an optional second parameter which can contain the following options

{
    limit: number, // limit the result to this number
    marker: value, // start the intersection a this value
}

License

MIT