Skip to content

Instantly share code, notes, and snippets.

View cblanquera's full-sized avatar
🌪️
Breaking Things.

Christian Blanquera cblanquera

🌪️
Breaking Things.
View GitHub Profile
export function magicMethods (clazz) {
// A toggle switch for the __isset method
// Needed to control "prop in instance" inside of getters
let issetEnabled = true
const classHandler = Object.create(null)
// Trap for class instantiation
classHandler.construct = (target, args, receiver) => {
// Wrapped class instance