Skip to main content
Module

x/rambda/uniqWith.js

Faster and smaller alternative to Ramda
Go to Latest
File
import { any } from './any'
export function uniqWith(predicate, list){ if (arguments.length === 1) return _list => uniqWith(predicate, _list)
let index = -1 const len = list.length const willReturn = []
while (++index < len){ const value = list[ index ] const flag = any(willReturnInstance => predicate(value, willReturnInstance), willReturn)
if (!flag){ willReturn.push(value) } }
return willReturn}