/
opt
/
canhelp
/
node_modules
/
nanostores
/
map
/
/opt/canhelp/node_modules/nanostores/map
mkdir
upload
Name
Size
Mode
Actions
index.d.ts
3858
0644
edit
dl
rm
index.js
536
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/nanostores/map/index.js
(536B)
import { atom } from '../atom/index.js' /* @__NO_SIDE_EFFECTS__ */ export const map = (initial = {}) => { let $map = atom(initial) $map.setKey = function (key, value) { let oldMap = $map.value if (typeof value === 'undefined' && key in $map.value) { $map.value = { ...$map.value } delete $map.value[key] $map.notify(oldMap, key) } else if ($map.value[key] !== value) { $map.value = { ...$map.value, [key]: value } $map.notify(oldMap, key) } } return $map }
Save
cmd:
run