MCPcopy
hub / github.com/bettercap/bettercap / fixMethod

Function fixMethod

modules/ui/ui/polyfills.js:576–588  ·  view source on GitHub ↗
(KEY)

Source from the content-addressed store, hash-verified

574 var proto = C && C.prototype;
575 var O = {};
576 var fixMethod = function (KEY) {
577 var fn = proto[KEY];
578 redefine(proto, KEY,
579 KEY == 'delete' ? function (a) {
580 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
581 } : KEY == 'has' ? function has(a) {
582 return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
583 } : KEY == 'get' ? function get(a) {
584 return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
585 } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; }
586 : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }
587 );
588 };
589 if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
590 new C().entries().next();
591 }))) {

Callers 1

polyfills.jsFile · 0.85

Calls 1

isObjectFunction · 0.85

Tested by

no test coverage detected