UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

14 lines (11 loc) 293 B
'use strict'; /** * Returns the difference between two arrays. * Create a Set from b, then use Array.prototype. * Filter() on a to only keep values not contained in b. */ function difference(a, b) { var s = new Set(b); return a.filter(x => !s.has(x)); } module.exports = difference;