MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / wrapObjectMethod

Function wrapObjectMethod

lib/web/polyfill.js:724–745  ·  view source on GitHub ↗
(key, MODE)

Source from the content-addressed store, hash-verified

722!function(){
723 // Object static methods accept primitives
724 function wrapObjectMethod(key, MODE){
725 var fn = Object[key]
726 , exp = core[OBJECT][key]
727 , f = 0
728 , o = {};
729 if(!exp || isNative(exp)){
730 o[key] = MODE == 1 ? function(it){
731 return isObject(it) ? fn(it) : it;
732 } : MODE == 2 ? function(it){
733 return isObject(it) ? fn(it) : true;
734 } : MODE == 3 ? function(it){
735 return isObject(it) ? fn(it) : false;
736 } : MODE == 4 ? function(it, key){
737 return fn(toObject(it), key);
738 } : function(it){
739 return fn(toObject(it));
740 };
741 try { fn(DOT) }
742 catch(e){ f = 1 }
743 $define(STATIC + FORCED * f, OBJECT, o);
744 }
745 }
746 wrapObjectMethod('freeze', 1);
747 wrapObjectMethod('seal', 1);
748 wrapObjectMethod('preventExtensions', 1);

Callers 1

polyfill.jsFile · 0.85

Calls 5

isNativeFunction · 0.85
fnFunction · 0.85
$defineFunction · 0.85
isObjectFunction · 0.70
toObjectFunction · 0.70

Tested by

no test coverage detected