source: trip-planner-front/node_modules/core-js/internals/redefine.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1var global = require('../internals/global');
2var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
3var has = require('../internals/has');
4var setGlobal = require('../internals/set-global');
5var inspectSource = require('../internals/inspect-source');
6var InternalStateModule = require('../internals/internal-state');
7
8var getInternalState = InternalStateModule.get;
9var enforceInternalState = InternalStateModule.enforce;
10var TEMPLATE = String(String).split('String');
11
12(module.exports = function (O, key, value, options) {
13 var unsafe = options ? !!options.unsafe : false;
14 var simple = options ? !!options.enumerable : false;
15 var noTargetGet = options ? !!options.noTargetGet : false;
16 var state;
17 if (typeof value == 'function') {
18 if (typeof key == 'string' && !has(value, 'name')) {
19 createNonEnumerableProperty(value, 'name', key);
20 }
21 state = enforceInternalState(value);
22 if (!state.source) {
23 state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
24 }
25 }
26 if (O === global) {
27 if (simple) O[key] = value;
28 else setGlobal(key, value);
29 return;
30 } else if (!unsafe) {
31 delete O[key];
32 } else if (!noTargetGet && O[key]) {
33 simple = true;
34 }
35 if (simple) O[key] = value;
36 else createNonEnumerableProperty(O, key, value);
37// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
38})(Function.prototype, 'toString', function toString() {
39 return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
40});
Note: See TracBrowser for help on using the repository browser.