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

Function _createPersistentIds

www/js/_hyperscript.js:3718–3731  ·  view source on GitHub ↗
(oldIdElements, newIdElements)

Source from the content-addressed store, hash-verified

3716 return { persistentIds, idMap };
3717 }
3718 function _createPersistentIds(oldIdElements, newIdElements) {
3719 var duplicateIds = /* @__PURE__ */ new Set(), oldIdTagNameMap = /* @__PURE__ */ new Map();
3720 for (var { id, tagName } of oldIdElements) {
3721 if (oldIdTagNameMap.has(id)) duplicateIds.add(id);
3722 else if (id) oldIdTagNameMap.set(id, tagName);
3723 }
3724 var persistentIds = /* @__PURE__ */ new Set();
3725 for (var { id, tagName } of newIdElements) {
3726 if (persistentIds.has(id)) duplicateIds.add(id);
3727 else if (oldIdTagNameMap.get(id) === tagName) persistentIds.add(id);
3728 }
3729 for (var id of duplicateIds) persistentIds.delete(id);
3730 return persistentIds;
3731 }
3732 function _populateIdMapWithTree(idMap, persistentIds, root, elements) {
3733 for (var elt of elements) {
3734 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