1 var META = require('./_uid')('meta')
2 , isObject = require('./_is-object')
3 , has = require('./_has')
4 , setDesc = require('./_object-dp').f
6 var isExtensible = Object.isExtensible || function(){
9 var FREEZE = !require('./_fails')(function(){
10 return isExtensible(Object.preventExtensions({}));
12 var setMeta = function(it){
13 setDesc(it, META, {value: {
14 i: 'O' + ++id, // object ID
15 w: {} // weak collections IDs
18 var fastKey = function(it, create){
19 // return primitive with prefix
20 if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
22 // can't set metadata to uncaught frozen object
23 if(!isExtensible(it))return 'F';
24 // not necessary to add metadata
25 if(!create)return 'E';
26 // add missing metadata
31 var getWeak = function(it, create){
33 // can't set metadata to uncaught frozen object
34 if(!isExtensible(it))return true;
35 // not necessary to add metadata
36 if(!create)return false;
37 // add missing metadata
39 // return hash weak collections IDs
42 // add metadata on freeze-family methods calling
43 var onFreeze = function(it){
44 if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
47 var meta = module.exports = {