mirror of https://github.com/sgoudham/carbon.git
parent
878e9e4f2e
commit
26ea4615f7
@ -1,10 +0,0 @@
|
||||
export const toHash = (array) => {
|
||||
return array.reduce((hash, item) => {
|
||||
const id = item.id
|
||||
if (hash[id]) {
|
||||
throw new Error('ID already exists')
|
||||
}
|
||||
hash[id] = item
|
||||
return hash
|
||||
}, {})
|
||||
}
|
Loading…
Reference in New Issue