This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nothing = new Proxy(Object.freeze(Object.create(null)), Object.create(null, { | |
get: { value(target, property) { | |
return property === Symbol.toPrimitive ? () => null : nothing } | |
} | |
})) | |
nothing.foo === nothing // true | |
nothing.foo.bar.baz[42].qux // nothing forever | |
typeof nothing === "object" // true |