mapOf moved to server lib
This commit is contained in:
1 parent
04db0114e7
commit
94d06aa8cd
3 files changed
+15
-17
No files matched your search
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
*
|
||||
* {a: {}, b: {}, ...} -> Map (a: Class, b: Class)
|
||||
*
|
||||
* @param Class
|
||||
* @param object
|
||||
*/
|
||||
exports.mapOf = function mapOf(Class, object) {
|
||||
return Object
|
||||
.entries(object)
|
||||
.reduce((map, i) => (
|
||||
map.set(i[0], new Class(i[1]))
|
||||
), new Map())
|
||||
}
|
||||
Reference in new issue
Block a user