1.0.1 • Published 8 years ago

@f/difference v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

difference

Build status Git tag NPM version Code style

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 from a
  • 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 pass getKey.

Returns: The result of filtering the items in list a to contain only items not found in list b.

License

MIT