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/es6.object.statics-accept-primitives.js
2015-07-15 15:06:18 +02:00

36 lines
1.3 KiB
JavaScript

/* */
var $ = require("./$"),
$def = require("./$.def"),
isObject = $.isObject,
toObject = $.toObject;
$.each.call(('freeze,seal,preventExtensions,isFrozen,isSealed,isExtensible,' + 'getOwnPropertyDescriptor,getPrototypeOf,keys,getOwnPropertyNames').split(','), function(KEY, ID) {
var fn = ($.core.Object || {})[KEY] || Object[KEY],
forced = 0,
method = {};
method[KEY] = ID == 0 ? function freeze(it) {
return isObject(it) ? fn(it) : it;
} : ID == 1 ? function seal(it) {
return isObject(it) ? fn(it) : it;
} : ID == 2 ? function preventExtensions(it) {
return isObject(it) ? fn(it) : it;
} : ID == 3 ? function isFrozen(it) {
return isObject(it) ? fn(it) : true;
} : ID == 4 ? function isSealed(it) {
return isObject(it) ? fn(it) : true;
} : ID == 5 ? function isExtensible(it) {
return isObject(it) ? fn(it) : false;
} : ID == 6 ? function getOwnPropertyDescriptor(it, key) {
return fn(toObject(it), key);
} : ID == 7 ? function getPrototypeOf(it) {
return fn(Object($.assertDefined(it)));
} : ID == 8 ? function keys(it) {
return fn(toObject(it));
} : require("./$.get-names").get;
try {
fn('z');
} catch (e) {
forced = 1;
}
$def($def.S + $def.F * forced, 'Object', method);
});