abstract
Version:
Abstraction of JavaScript Objects.
77 lines (76 loc) • 4.13 kB
JavaScript
/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['polyfills.js']) {
_$jscoverage['polyfills.js'] = [];
_$jscoverage['polyfills.js'][9] = 0;
_$jscoverage['polyfills.js'][20] = 0;
_$jscoverage['polyfills.js'][22] = 0;
_$jscoverage['polyfills.js'][23] = 0;
_$jscoverage['polyfills.js'][24] = 0;
_$jscoverage['polyfills.js'][26] = 0;
_$jscoverage['polyfills.js'][27] = 0;
_$jscoverage['polyfills.js'][31] = 0;
_$jscoverage['polyfills.js'][32] = 0;
_$jscoverage['polyfills.js'][33] = 0;
_$jscoverage['polyfills.js'][34] = 0;
_$jscoverage['polyfills.js'][37] = 0;
_$jscoverage['polyfills.js'][39] = 0;
_$jscoverage['polyfills.js'][40] = 0;
_$jscoverage['polyfills.js'][42] = 0;
_$jscoverage['polyfills.js'][44] = 0;
_$jscoverage['polyfills.js'][46] = 0;
_$jscoverage['polyfills.js'][47] = 0;
_$jscoverage['polyfills.js'][50] = 0;
_$jscoverage['polyfills.js'][54] = 0;
}
_$jscoverage['polyfills.js'][9]++;
module.exports = {setPrototypeOf: (function setPrototypeOf(Object, magic) {
_$jscoverage['polyfills.js'][20]++;
var set;
_$jscoverage['polyfills.js'][22]++;
function checkArgs(O, proto) {
_$jscoverage['polyfills.js'][23]++;
if (typeof O !== "object" || O === null) {
_$jscoverage['polyfills.js'][24]++;
throw new TypeError("can not set prototype on a non-object");
}
_$jscoverage['polyfills.js'][26]++;
if (typeof proto !== "object" && proto !== null) {
_$jscoverage['polyfills.js'][27]++;
throw new TypeError("can only set prototype to an object or null");
}
}
_$jscoverage['polyfills.js'][31]++;
function setPrototypeOf(O, proto) {
_$jscoverage['polyfills.js'][32]++;
checkArgs(O, proto);
_$jscoverage['polyfills.js'][33]++;
set.call(O, proto);
_$jscoverage['polyfills.js'][34]++;
return O;
}
_$jscoverage['polyfills.js'][37]++;
try {
_$jscoverage['polyfills.js'][39]++;
set = Object.getOwnPropertyDescriptor(Object.prototype, magic).set;
_$jscoverage['polyfills.js'][40]++;
set.call({}, null);
}
catch (o_O) {
_$jscoverage['polyfills.js'][42]++;
if (Object.prototype !== {}[magic]) {
_$jscoverage['polyfills.js'][44]++;
return;
}
_$jscoverage['polyfills.js'][46]++;
set = (function (proto) {
_$jscoverage['polyfills.js'][47]++;
this[magic] = proto;
});
_$jscoverage['polyfills.js'][50]++;
setPrototypeOf.polyfill = setPrototypeOf(setPrototypeOf({}, null), Object.prototype) instanceof Object;
}
_$jscoverage['polyfills.js'][54]++;
return setPrototypeOf;
})};
_$jscoverage['polyfills.js'].source = ["/**"," * -"," *"," * -"," *"," * @author potanin"," * @date 7/5/13"," */","module.exports = {"," /**"," * Add Object.setPrototypeOf()"," *"," * @source: https://gist.github.com/WebReflection/5593554#file-object-setprototypeof-js"," *"," * @param Object"," * @param magic"," * @returns {Function}"," */"," setPrototypeOf: function setPrototypeOf( Object, magic ) {"," var set;",""," function checkArgs( O, proto ) {"," if( typeof O !== 'object' || O === null ) {"," throw new TypeError( 'can not set prototype on a non-object' );"," }"," if( typeof proto !== 'object' && proto !== null ) {"," throw new TypeError( 'can only set prototype to an object or null' );"," }"," }",""," function setPrototypeOf( O, proto ) {"," checkArgs( O, proto );"," set.call( O, proto );"," return O;"," }",""," try {"," // this works already in Firefox and Safari"," set = Object.getOwnPropertyDescriptor( Object.prototype, magic ).set;"," set.call( {}, null );"," } catch( o_O ) {"," if( Object.prototype !== {}[magic] ) {"," // IE < 11 cannot be shimmed"," return;"," }"," set = function( proto ) {"," this[magic] = proto;"," };",""," setPrototypeOf.polyfill = setPrototypeOf( setPrototypeOf( {}, null ), Object.prototype ) instanceof Object;",""," }",""," return setPrototypeOf;",""," }","};"];