Socket
Book a DemoInstallSign in
Socket

sorted-intersect

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sorted-intersect

Intersect sorted lists using merge intersection with galloping lookahead

latest
Source
npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

sorted-intersect

Intersect sorted lists using merge intersection with galloping lookahead.

npm install sorted-intersect

It is useful if you want to (efficiently) 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,
	offsets: []    // use these list offsets (mutates the array)
}

License

MIT

Keywords

intersect

FAQs

Package last updated on 30 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts