MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / _createPersistentIds

Function _createPersistentIds

tools/common/_hyperscript.iife.js:3558–3571  ·  view source on GitHub ↗
(oldIdElements, newIdElements)

Source from the content-addressed store, hash-verified

3556 return { persistentIds, idMap };
3557 }
3558 function _createPersistentIds(oldIdElements, newIdElements) {
3559 var duplicateIds = /* @__PURE__ */ new Set(), oldIdTagNameMap = /* @__PURE__ */ new Map();
3560 for (var { id, tagName } of oldIdElements) {
3561 if (oldIdTagNameMap.has(id)) duplicateIds.add(id);
3562 else if (id) oldIdTagNameMap.set(id, tagName);
3563 }
3564 var persistentIds = /* @__PURE__ */ new Set();
3565 for (var { id, tagName } of newIdElements) {
3566 if (persistentIds.has(id)) duplicateIds.add(id);
3567 else if (oldIdTagNameMap.get(id) === tagName) persistentIds.add(id);
3568 }
3569 for (var id of duplicateIds) persistentIds.delete(id);
3570 return persistentIds;
3571 }
3572 function _populateIdMapWithTree(idMap, persistentIds, root, elements) {
3573 for (var elt of elements) {
3574 if (persistentIds.has(elt.id)) {

Callers 1

_createIdMapsFunction · 0.70

Calls 3

setMethod · 0.45
getMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected