feat: always use index for buckets

This commit is contained in:
Dominik Pschenitschni 2021-09-07 15:42:41 +02:00
parent 672d63fbed
commit 8d88b3792d
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
4 changed files with 94 additions and 54 deletions

View file

@ -1,10 +0,0 @@
export const filterObject = (obj, fn) => {
let key
for (key in obj) {
if (fn(obj[key])) {
return key
}
}
return null
}

View file

@ -1,3 +1,7 @@
export function findIndexById(array : [], id : string | number) {
return array.findIndex(({id: currentId}) => currentId === id)
}
export function findById(array : [], id : string | number) {
return array.find(({id: currentId}) => currentId === id)
}