UNPKG

weird-instanceof

Version:

Call your functions using instanceof operator (drunk programming only)

24 lines (20 loc) 585 B
// Drunk programming only +-~function() { class DrunkInstanceof { constructor(customFunction) { this.customFunction = customFunction; } [Symbol.hasInstance](arg) { return this.customFunction(arg); } get [Symbol.toStringTag]() { return `DrunkInstanceof`; } toString() { return `[Object DrunkInstanceof]`; } } window.InstanceOfFunction = customFunction => { return new DrunkInstanceof(customFunction); } }();