Sha256: a01a2e949cb0ff7418dcd95363d808ee4e38293ea3a19a6bdbe0e3593547c5c6

Contents?: true

Size: 1.55 KB

Versions: 7

Compression:

Stored size: 1.55 KB

Contents

var global = require('../internals/global');
var shared = require('../internals/shared');
var hide = require('../internals/hide');
var has = require('../internals/has');
var setGlobal = require('../internals/set-global');
var nativeFunctionToString = require('../internals/function-to-string');
var InternalStateModule = require('../internals/internal-state');

var getInternalState = InternalStateModule.get;
var enforceInternalState = InternalStateModule.enforce;
var TEMPLATE = String(nativeFunctionToString).split('toString');

shared('inspectSource', function (it) {
  return nativeFunctionToString.call(it);
});

(module.exports = function (O, key, value, options) {
  var unsafe = options ? !!options.unsafe : false;
  var simple = options ? !!options.enumerable : false;
  var noTargetGet = options ? !!options.noTargetGet : false;
  if (typeof value == 'function') {
    if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
    enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  }
  if (O === global) {
    if (simple) O[key] = value;
    else setGlobal(key, value);
    return;
  } else if (!unsafe) {
    delete O[key];
  } else if (!noTargetGet && O[key]) {
    simple = true;
  }
  if (simple) O[key] = value;
  else hide(O, key, value);
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, 'toString', function toString() {
  return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
jester-data-8.0.0 node_modules/core-js/internals/redefine.js
ezii-os-5.2.1 node_modules/core-js/internals/redefine.js
ezii-os-2.0.1 node_modules/core-js/internals/redefine.js
ezii-os-1.1.0 node_modules/core-js/internals/redefine.js
ezii-os-1.0.0 node_modules/core-js/internals/redefine.js
ezii-os-0.0.0.1.0 node_modules/core-js/internals/redefine.js
ezii-os-0.0.0.0.1 node_modules/core-js/internals/redefine.js