mirror of
https://github.com/Doodle3D/Doodle3D-API
synced 2024-12-23 22:13:48 +01:00
36 lines
1.3 KiB
JavaScript
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);
|
||
|
});
|