MCPcopy
hub / github.com/tdewolff/minify / enableClassCheck

Function enableClassCheck

_benchmarks/sample_echarts.js:8078–8089  ·  view source on GitHub ↗

* Implements `CheckableConstructor` for `target`. * Can not use instanceof, consider different scope by * cross domain or es module import in ec extensions. * Mount a method "isInstance()" to Clz. * * @usage * ```ts * class Xxx {} * type XxxConstructor = typeo

(target)

Source from the content-addressed store, hash-verified

8076 */
8077
8078 function enableClassCheck(target) {
8079 var classAttr = ['__\0is_clz', classBase++].join('_');
8080 target.prototype[classAttr] = true;
8081
8082 if ("development" !== 'production') {
8083 assert(!target.isInstance, 'The method "is" can not be defined.');
8084 }
8085
8086 target.isInstance = function (obj) {
8087 return !!(obj && obj[classAttr]);
8088 };
8089 } // superCall should have class info, which can not be fetch from 'this'.
8090 // Consider this case:
8091 // class A has method f,
8092 // class B inherits class A, overrides method f, f call superApply('f'),

Callers 1

sample_echarts.jsFile · 0.85

Calls 1

assertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…