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

Function def

lib/web/polyfill.js:1595–1616  ·  view source on GitHub ↗
(that, key, value)

Source from the content-addressed store, hash-verified

1593 }
1594 }
1595 function def(that, key, value){
1596 var entry = getEntry(that, key)
1597 , prev, index;
1598 // change existing entry
1599 if(entry)entry.v = value;
1600 // create new entry
1601 else {
1602 that[LAST] = entry = {
1603 i: index = fastKey(key, true), // <- index
1604 k: key, // <- key
1605 v: value, // <- value
1606 p: prev = that[LAST], // <- previous entry
1607 n: undefined, // <- next entry
1608 r: false // <- removed
1609 };
1610 if(!that[FIRST])that[FIRST] = entry;
1611 if(prev)prev.n = entry;
1612 that[SIZE]++;
1613 // add to index
1614 if(index != 'F')that[O1][index] = entry;
1615 } return that;
1616 }
1617
1618 var collectionMethods = {
1619 // 23.1.3.1 Map.prototype.clear()

Callers 1

polyfill.jsFile · 0.70

Calls 2

getEntryFunction · 0.85
fastKeyFunction · 0.85

Tested by

no test coverage detected