This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const makeSealer = () => {
let open = null
return {
seal(value) {
const box = () => open === box && value
return box
},
unseal(box) {
open = box
const result = box()
open = null
return result
},
}
}
const s = makeSealer()
const o = {a: 1}
const box = s.seal(o)
console.log(s.unseal(box))
console.log(s.unseal(() => {}))