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
@@ -31,22 +31,6 @@ function any(list) {
|
||||
return list.reduce((t, i) => t || i, false)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {a: {}, b: {}, ...} -> Map (a: Class, b: Class)
|
||||
*
|
||||
* @param Class
|
||||
* @param object
|
||||
*/
|
||||
function mapOf(Class, object) {
|
||||
return Object
|
||||
.entries(object)
|
||||
.reduce((map, i) => (
|
||||
map.set(i[0], new Class(i[1]))
|
||||
), new Map())
|
||||
}
|
||||
|
||||
exports.compose = compose
|
||||
exports.all = all
|
||||
exports.any = any
|
||||
exports.mapOf = mapOf
|
||||
Reference in new issue
Block a user