@ngard/tiny-difference
v1.0.0
Published
A minimal-weight lodash.difference equivalent utility
Downloads
816
Readme
tiny-difference
A minimal-weight utility identical to lodash.difference
. For when every byte counts!
lodash.difference tiny-difference
Syntax
difference(/* array, [...arrays] */)
Parameters
array
- The array to calculate the difference to. Resulting array elements are in the same order as appear in this array
arrays
- Any number of other arrays, whose elements will not appear in the returned array
Return
A new array containing only the elements found in the first array and not in the other arrays, in the order as they appear in the first array.
Example
import { difference } from '@ngard/tiny-difference';
const diff = difference([1,2,3,4], [1,2]); // returns [3,4]
const diff = difference([1,2,3,4], [1,2], [2,3,5]); // returns [4]