UNPKG
@autobe/compiler
Version:
latest (0.29.2)
0.29.2
0.29.1
0.29.0
0.28.1
0.28.0
0.27.0
0.26.0
0.25.7
0.25.6
0.25.5
0.25.4
0.25.3
0.25.2
0.25.1
0.25.0
0.24.2
0.24.1
0.24.0
0.23.1
0.23.0
0.22.1
0.22.0
0.21.0
0.20.0
0.19.1
0.18.0
0.17.1
0.16.1
0.16.0
0.15.1
0.15.0
0.14.6
0.14.5
0.14.4
0.14.3
0.14.2
0.13.0
0.12.0
0.11.2
0.11.1
0.11.0
0.10.6
0.10.5
0.10.4
0.10.3
0.10.2
0.10.1
0.10.0
0.9.2
0.9.1
0.9.0
0.8.0
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.24
0.3.23
0.3.22
0.3.21
0.3.20
0.3.19
0.3.18
0.3.17
0.3.16
0.3.15
0.3.14
0.3.13
0.3.12
0.3.11
0.3.9
0.3.6
0.3.5
0.0.0
AI backend server code generator
github.com/wrtnlabs/autobe
wrtnlabs/autobe
@autobe/compiler
/
src
/
utils
/
MapUtil.ts
11 lines
(10 loc)
•
248 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
export
namespace
MapUtil
{
export
function
take<K, V>(
map
:
Map
<K, V>,
key
: K,
value
:
() =>
V): V {
if
(map.
has
(key)) {
return
map.
get
(key)
as
V; }
const
newValue =
value
(); map.
set
(key, newValue);
return
newValue; } }