UNPKG

lenye_base

Version:

基础方法

13 lines (10 loc) 286 B
'use strict'; /** * Returns the difference between two arrays, * after applying the provided function to each array element of both. */ function differenceBy(a, b, fn) { var s = new Set(b.map(fn)); return a.map(fn).filter(el => !s.has(el)); } module.exports = differenceBy;