# set-comparision Release 1.0.2

Compare two Sets by comparing elements' existences

Keywords
set, compare-set, set-equality, subset, equal-set
MIT
Install
``` npm install set-comparision@1.0.2 ```

# set-comparision

ECMAScript 6

## Usage

### Import

#### Normal

`const compare = require('set-comparision') // Equivalent to `template(template.OBJECT_EQUAL)`, see below`

```const template = require('set-comparision/x')
const compare = template(myEqualFunction)```

### Functions

• `A` and `B` are instances of a `Set`-like class

• `a` and `b` are elements of `A` and `B` above

#### `compare(A, B)`

Equivalent to `compare.equal(A, B)`

#### `compare.equal(A, B)`

Returns `true` if every elements of `A` are found in `B` and vice versa

#### `compare.subset(A, B)`

Returns `true` if `A` is a subset of `B`

#### `compare.superset(A, B)`

Returns `true` if `A` is a superset of `B`

#### `compare.notFunc(A, B)`

• with `Func` is either `Equal`, `Subset` or `Superset`

Returns negative boolean of `compare.func(A, B)`, e.g. `compare.notEqual(A, B)` is `!compare.equal(A, B)`

#### `compare.xCompareSet(myEqualFunction)`

Create a new set of set-comparision functions based on `myEqualFunction` as element equality function

`myEqualFunction` takes 2 parameters, which are `a` and `b`, and returns a boolean which `true` for equal and `false` otherwise

Equivalent to `template(myEqualFunction)` with `template = require('set-comparision/x')`

#### `compare.for(myEqualFunction)`

Equivalent to `compare.xCompareSet(myEqualFunction)`

#### `compare.STRICT_EQUAL(a, b)`

`compare.STRICT_EQUAL = (a, b) => a === b`

#### `compare.OBJECT_EQUAL(a, b)`

`compare.OBJECT_EQUAL = (a, b) => Object.is(a, b)`