# bloom-filter-javascript

> Bloom Filter for Javascript

Latest version **0.1.4** (published 2015-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install bloom-filter-javascript
pnpm add bloom-filter-javascript
yarn add bloom-filter-javascript
bun add bloom-filter-javascript
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2015-11-02 |
| First published | 2015-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | jo32 |
| Maintainers | jo32 |
| Keywords | bloom, filter |

## Links

- npm: https://www.npmjs.com/package/bloom-filter-javascript
- Repository: https://github.com/jo32/bloom-filter
- Homepage: https://github.com/jo32/bloom-filter#readme
- Issues: https://github.com/jo32/bloom-filter/issues
- npm.io page: https://npm.io/package/bloom-filter-javascript

## Dependencies (2)

- [big-integer](https://npm.io/package/big-integer.md) ^1.6.3
- [non-crypto-hash](https://npm.io/package/non-crypto-hash.md) ^0.1.0

## Recent versions

- 0.1.4 (latest) — 2015-11-02
- 0.1.3 — 2015-10-28
- 0.1.2 — 2015-10-28
- 0.1.1 — 2015-10-28
- 0.1.0 — 2015-10-28

## README

# Bloom Filter for Javascript

This package contains bloom filter worked in both browser and Node.js, the hash function is default to be MurmurHash3 hashing the obj.toString().

## Installation

    npm install bloom-filter-javascript

## Usage

    var BloomFilter = require('bloom-filter');
    var bf = new BloomFilter({
        elements: [1, 2, 3],
        p: 0.001 // default value of false positive rate
    });
    bf.has(1) // true

## API

### Constructors

#### BloomFilter(opts)

An example of parameter:

    {
        elements: [...], // required, Array
        p: 0.01, // optianal, Number, 0 to 1, exclusive,
        hash: function(str, seed) {...} // optianal, hash function supporting seed
    }

#### BloomFilter(inputString[, hashFunc])

1. `inputString`: the result of `BloomFilter.prototype.toString()`
2. `hashFunc`: hash function supporting seed

### Methods

#### has(obj)

return true if the instance constains the obj.

#### toString()

return a hex string of this bloom filter

## Notice

Hashing function takes the result of elements' toString() result as input by default. However, you can implements your own hash function.

---
_Source: https://npm.io/package/bloom-filter-javascript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
