cpt-waffle-lotide
Version:
LoTide in Typescript
17 lines (14 loc) • 363 B
text/typescript
const without = (source:any[], itemsToRemove:any[]):any[] => {
interface Hash { [key: string]: any };
const obj: Hash = {};
itemsToRemove.forEach((item:any) => {
obj[item] = item;
})
const result:any[] = [];
source.forEach((item:any) => {
if (obj[item] && obj[item] === item) return;
result.push(item);
})
return result;
}
export default without;