mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* Compile Effect generators statically * test: declare the dormant array write's expected fence
22 lines
726 B
JavaScript
22 lines
726 B
JavaScript
export function useMap(map) {
|
|
console.log(map instanceof Map, map.size, map.get("from typed"));
|
|
console.log(map.set("key", "value") === map);
|
|
map.set(NaN, "nan");
|
|
map.set(undefined, undefined);
|
|
map.set(-0, "zero");
|
|
console.log(map.has(NaN), map.get(0), map.has("absent"));
|
|
console.log(map.delete(0), map.delete(0), map.get(0));
|
|
}
|
|
|
|
export function copyMap(map) {
|
|
const copy = new Map(map);
|
|
console.log(copy.size, copy.get("key"), copy.get(NaN), copy.has(undefined));
|
|
copy.delete("key");
|
|
console.log(map.has("key"), copy.has("key"));
|
|
const object = {};
|
|
map.set(object, object);
|
|
const shallow = new Map(map);
|
|
console.log(shallow.has(object), shallow.get(object) === object);
|
|
map.delete(object);
|
|
}
|