1.0.0 • Published 5 years ago

@ngard/tiny-difference v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

tiny-difference

source bundle size build status license

A minimal-weight utility identical to lodash.difference. For when every byte counts!

lodash.difference bundle size tiny-difference bundle size

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]