Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2919731
weakmap.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
566 B
Referenced Files
None
Subscribers
None
weakmap.js
View Options
import
{
test
,
summary
}
from
'./helpers.js'
;
console
.
log
(
'WeakMap Tests\n'
);
const
wm
=
new
WeakMap
();
const
key1
=
{};
const
key2
=
{};
wm
.
set
(
key1
,
'value1'
);
wm
.
set
(
key2
,
42
);
test
(
'weakmap get'
,
wm
.
get
(
key1
),
'value1'
);
test
(
'weakmap get number'
,
wm
.
get
(
key2
),
42
);
test
(
'weakmap has true'
,
wm
.
has
(
key1
),
true
);
test
(
'weakmap has false'
,
wm
.
has
({}),
false
);
wm
.
delete
(
key1
);
test
(
'weakmap delete'
,
wm
.
has
(
key1
),
false
);
const
key3
=
{
id
:
1
};
wm
.
set
(
key3
,
'test'
);
wm
.
set
(
key3
,
'updated'
);
test
(
'weakmap overwrite'
,
wm
.
get
(
key3
),
'updated'
);
summary
();
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Mar 27, 4:20 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
512553
Default Alt Text
weakmap.js (566 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment