mirror of https://github.com/sgoudham/carbon.git
Default theme
parent
bb9efd6e38
commit
d6b4db144a
@ -0,0 +1,10 @@
|
||||
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