F
Size: a a a
F
F
L
const distinct = (f = _ => _, set = new Set) =>
(val, tmp) => (
tmp = f(val),
!(set.has(tmp) || set.add(tmp) && false)
)
L
[1,2,3,3].filter( distinct() )
[{name:'vasya'}, {name:'vasya'}].filter( distinct(v => v.name) )
[{name:'vasya',surname:'pupkin'},{name:'vasya',surname:'pupkin'}].filter( distinct(v => v.name) )
F
F
F
F
const distinct = (f = _ => _, set = new Set) =>
(val, tmp) => (
tmp = f(val),
!(set.has(tmp) || set.add(tmp) && false)
)
F
L
L
F
L
const distinct = (f = _ => _, set = new Set) =>
(val, tmp) => (
tmp = f(val),
!(set.has(tmp) || set.add(tmp) && false)
)
const distinctDeepObj = distinct(v => JSON.stringify(v))
L
F
F
L
const distinct = (f = _ => _, set = new Set) =>
(val, tmp) => (
tmp = f(val),
!(set.has(tmp) || set.add(tmp) && false)
)
const distinctDeepObj = distinct(v => JSON.stringify(v))
L
L
F