UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

22 lines (16 loc) 449 B
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 }