difference
Subtract one list from another
Installation
$ npm install @f/difference
Usage
var difference = require('@f/difference')
difference([1, 2, 3], [2, 3, 4]) // -> [1]
difference([1, 2], [3, 4]) // -> [1, 2]
API
difference(a, b, getKey)
-
a
- The list to be subtracted from -
b
- The list to subtract froma
-
getKey
- Optional key function for the items of both lists. If not passed, a much slower algorithm is used. It is highly recommended that you passgetKey
.
Returns: The result of filtering the items in list a
to contain only items not found in list b
.
License
MIT