0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-12-23 14:13:47 +01:00
Doodle3D-API/jspm_packages/npm/core-js@0.9.18/modules/$.set-proto.js
2015-07-15 15:06:18 +02:00

27 lines
671 B
JavaScript

/* */
var $ = require("./$"),
assert = require("./$.assert");
function check(O, proto) {
assert.obj(O);
assert(proto === null || $.isObject(proto), proto, ": can't set as prototype!");
}
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? function(buggy, set) {
try {
set = require("./$.ctx")(Function.call, $.getDesc(Object.prototype, '__proto__').set, 2);
set({}, []);
} catch (e) {
buggy = true;
}
return function setPrototypeOf(O, proto) {
check(O, proto);
if (buggy)
O.__proto__ = proto;
else
set(O, proto);
return O;
};
}() : undefined),
check: check
};