Sha256: 8d518f410dd8bf666019cb9c878004bce8a11a8f31abbee0394183eb26bf68b4

Contents?: true

Size: 1.52 KB

Versions: 82

Compression:

Stored size: 1.52 KB

Contents

var META = require('./_uid')('meta');
var isObject = require('./_is-object');
var has = require('./_has');
var setDesc = require('./_object-dp').f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
  return true;
};
var FREEZE = !require('./_fails')(function () {
  return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
  setDesc(it, META, { value: {
    i: 'O' + ++id, // object ID
    w: {}          // weak collections IDs
  } });
};
var fastKey = function (it, create) {
  // return primitive with prefix
  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return 'F';
    // not necessary to add metadata
    if (!create) return 'E';
    // add missing metadata
    setMeta(it);
  // return object ID
  } return it[META].i;
};
var getWeak = function (it, create) {
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return true;
    // not necessary to add metadata
    if (!create) return false;
    // add missing metadata
    setMeta(it);
  // return hash weak collections IDs
  } return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  return it;
};
var meta = module.exports = {
  KEY: META,
  NEED: false,
  fastKey: fastKey,
  getWeak: getWeak,
  onFreeze: onFreeze
};

Version data entries

82 entries across 38 versions & 8 rubygems

Version Path
immosquare-cleaner-0.1.40 node_modules/core-js/modules/_meta.js
immosquare-cleaner-0.1.40 node_modules/core-js/library/modules/_meta.js
optimacms-0.1.61 spec/dummy/node_modules/babel-runtime/node_modules/core-js/library/modules/_meta.js
optimacms-0.1.61 spec/dummy/node_modules/babel-runtime/node_modules/core-js/modules/_meta.js
ilog-0.4.1 node_modules/babel-runtime/node_modules/core-js/library/modules/_meta.js
ilog-0.4.1 node_modules/babel-register/node_modules/core-js/modules/_meta.js
ilog-0.4.1 node_modules/babel-register/node_modules/core-js/library/modules/_meta.js
ilog-0.4.1 node_modules/babel-runtime/node_modules/core-js/modules/_meta.js
ilog-0.4.0 node_modules/babel-runtime/node_modules/core-js/library/modules/_meta.js
ilog-0.4.0 node_modules/babel-register/node_modules/core-js/modules/_meta.js
ilog-0.4.0 node_modules/babel-register/node_modules/core-js/library/modules/_meta.js
ilog-0.4.0 node_modules/babel-runtime/node_modules/core-js/modules/_meta.js
ilog-0.3.3 node_modules/babel-runtime/node_modules/core-js/library/modules/_meta.js
ilog-0.3.3 node_modules/babel-register/node_modules/core-js/modules/_meta.js
ilog-0.3.3 node_modules/babel-register/node_modules/core-js/library/modules/_meta.js
ilog-0.3.3 node_modules/babel-runtime/node_modules/core-js/modules/_meta.js
condenser-0.0.5 lib/condenser/processors/node_modules/core-js/library/modules/_meta.js
condenser-0.0.5 lib/condenser/processors/node_modules/core-js/modules/_meta.js
optimacms-0.4.3 spec/dummy/node_modules/core-js/library/modules/_meta.js
optimacms-0.4.3 spec/dummy/node_modules/core-js/modules/_meta.js