# specialized-set

> A performant flexible set

Latest version **0.0.3** (published 2013-05-19) · LGPLv3 license · 0 weekly downloads

## Install

```sh
npm install specialized-set
pnpm add specialized-set
yarn add specialized-set
bun add specialized-set
```

## 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.0.3 |
| Published | 2013-05-19 |
| First published | 2013-05-19 |
| Weekly downloads | 0 |
| License | LGPLv3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | spjoe |
| Keywords | set, binary tree |

## Links

- npm: https://www.npmjs.com/package/specialized-set
- Repository: https://github.com/spjoe/specializedSet
- Issues: https://github.com/spjoe/specializedSet/issues
- npm.io page: https://npm.io/package/specialized-set

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2013-05-19
- 0.0.2 — 2013-05-19
- 0.0.1 — 2013-05-19

## README

# 

[![Build Status](https://travis-ci.org/spjoe/specializedSet.png?branch=master)](https://travis-ci.org/spjoe/)
[![Coverage Status](https://coveralls.io/repos/spjoe/specializedSet/badge.png?branch=master)](https://coveralls.io/r/spjoe/)
[![Dependency Status](https://gemnasium.com/spjoe/specializedSet.png)](https://gemnasium.com/spjoe/)

## Introduction

This lib provides a set that uses a binary tree as data structure. If you are able to hash all or object use a hash set instead, it is faster! If not and you can provide a complete lesser and equality function for your objects you can use this set. 

Speed Comparison for insert, find, remove;
HashSet is O(1)
BinaryTree is O(log(n))
Array is O(n)

## Installation

    $ npm install specialized-set

## Usage
```js
var equalityFunction = function(a,b){return a == b};
var lesserFunction = function(a,b){return a < b};
var SpecializedSet = require('../')(equalityFunction, lesserFunction);

var set1 = new SpecializedSet(['a', 'd','c','c']);
var set2 = new SpecializedSet(['b','d','e']);

set1.add('x');
set1.values(); // ['a','c','d','x'];

set1.minus(new SpecializedSet(['x']))
set1.values(); // ['a','c','d'];
// or
SpecializedSet.minus(set1, new SpecializedSet(['x']))
set1.values(); // ['a','c','d'];

set1.union(set2).values(); // ['a','b','c','d','e'] 
// or
SpecializedSet.union(set1, set2).values(); // ['a','b','c','d','e'] 

set1.intersect(set2).values(); // ['d'] 
// or
SpecializedSet.intersect(set1, set2).values(); // ['d'] 

set1.equals(set2); // false
// or
SpecializedSet.equals(set1, set2)// false

set1.equals(new SpecializedSet(['a', 'd','c'])); // true
```

## License

  LGPLv3

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