const syntaxError = () => {
throw Error('SyntaxError: invalid syntax')
}
const NOOP = function() {}
const createPureProxy = (options={}) => {
const handler = {
apply(target, thisArg, argumentsList) {
syntaxError()
},
construct(target, argumentsList, newTarget) {
syntaxError()
},
defineProperty(target, property, descriptor) {
syntaxError()
},
deleteProperty(target, property) {
syntaxError()
},
getOwnPropertyDescriptor(target, prop) {
syntaxError()
},
getPrototypeOf(target) {
syntaxError()
},
has(target, prop) {
syntaxError()
},
isExtensible(target) {
syntaxError()
},
ownKeys(target) {
syntaxError()
},
preventExtensions(target) {
syntaxError()
},
get(target, property, receiver) {
syntaxError()
},
set(target, property, value, receiver) {
syntaxError()
},
setPrototypeOf(target, prototype) {
syntaxError()
},
...options,
}
return new Proxy(NOOP, handler)
}
const str = exoticObject({
data: {
count: 1,
},
apply: (target, thisArg, argumentsList) => {
syntaxError()
},
get: {
title: () => {},
},
set: (target) => {
}
})