UNPKG

lenye_base

Version:

基础方法

14 lines (11 loc) 297 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;