deno.land / x / rambda@v9.1.1 / src / differenceWith.js

differenceWith.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { curry } from './curry.js'import { _indexOf } from './equals.js'
export function differenceWithFn( fn, a, b){ const willReturn = [] const [ first, second ] = a.length > b.length ? [ a, b ] : [ b, a ]
first.forEach(item => { const hasItem = second.some(secondItem => fn(item, secondItem)) if (!hasItem && _indexOf(item, willReturn) === -1){ willReturn.push(item) } })
return willReturn}
export const differenceWith = curry(differenceWithFn)
rambda

Version Info

Tagged at
2 months ago