MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / fastKey

Function fastKey

lib/web/polyfill.js:1573–1585  ·  view source on GitHub ↗
(it, create)

Source from the content-addressed store, hash-verified

1571 }
1572
1573 function fastKey(it, create){
1574 // return primitive with prefix
1575 if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
1576 // can't set id to frozen object
1577 if(isFrozen(it))return 'F';
1578 if(!has(it, UID)){
1579 // not necessary to add id
1580 if(!create)return 'E';
1581 // add missing object id
1582 hidden(it, UID, ++uid);
1583 // return object id with prefix
1584 } return 'O' + it[UID];
1585 }
1586 function getEntry(that, key){
1587 // fast case
1588 var index = fastKey(key), entry;

Callers 2

getEntryFunction · 0.85
defFunction · 0.85

Calls 2

isObjectFunction · 0.70
hasFunction · 0.70

Tested by

no test coverage detected