🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@aggregion/binary-filter

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aggregion/binary-filter

Small package for compact store numbers in bit mask, calculate count of unique numbers

0.2.2
latest
npm
Version published
Weekly downloads
7
133.33%
Maintainers
6
Weekly downloads
 
Created
Source

JS Binary Filter

Small package for compact store numbers in bit mask, calculate count of unique numbers

Install

npm i @aggregion/binary-filter

Usage

Binary filter add entries:

import {BinaryFilter} from '@aggregion/binary-filter'


const filter = new BinaryFilter(10000);

filter.add(1);
filter.add(12);
filter.add(20);
filter.add(1);

filter.has(1) // true
filter.has(5) // false
filter.length // 3

Create from list

const filter = BinaryFilter.from([1,2,3]);

Union and intersections

const filter1 = BinaryFilter.from([1,2,3]);
const filter2 = BinaryFilter.from([2,3,5]);

const union = filter1.union(filter2); // new filter, that contains 1,2,3,5
const intersection = filter2.intersect(filter2); // new filter, that contains 2,3

FAQs

Package last updated on 23 Nov 2022

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