UNPKG
@benev/nubs
Version:
latest (0.3.0-dev.2)
0.3.0-dev.2
0.3.0-dev.1
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.0
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
0.0.0
0.0.0-dev.0
user-input system for web games
github.com/benevolent-games/nubs
benevolent-games/nubs
@benev/nubs
/
s
/
tools
/
object-map.ts
14 lines
(9 loc)
•
267 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export
function
objectMap<
Input
extends
{},
Output
extends
{}>(
input
:
Input
,
mapper
:
(
value
:
any
,
key
:
string
) =>
any
):
Output
{
const
output
:
any
= {}
for
(
const
[key, value]
of
Object
.
entries
(input)) output[key] =
mapper
(value, key)
return
output }