UNPKG
ensure-key
Version:
latest (1.0.2)
1.0.2
1.0.1
1.0.0
Safe member access with initial value assignment.
ensure-key
/
test.ts
8 lines
(4 loc)
•
170 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
import
'./Ensure'
;
const
registry = {}; registry.
ensure
(
'abc'
, {}).
ensure
(
'items'
, []).
push
(
123
);
console
.
log
(registry);
// --> { abc: { items: [ 123 ] } }