INNER CODE UNIT · JavaScript
indexInParent
AscensionGameDev/Intersect-Engine · Intersect.Server/wwwroot/js/assets.js:955
const indexInParent = parent.children.findIndex(c => c.id === nodeId);
if (indexInParent < 0) {
console.debug(`Parent ${parent.id} does not contain ${nodeId}`);
continue;
}
console.debug(`Removing from parent: ${nodeId}`);
parent.children.splice(indexInParent, 1);
}
}
if (Array.isArray(addNodes) && addNodes.length > 0) {
const sortedNodes = addNodes.toSorted((a, b) => a?.id?.localeCompare(b?.id) ?? 1);
for (const node of sortedNodes) {
const parent = this.#navigateToParent(this.#tree, node.Path, true);
if (parent === null) {
console.warn('Parent was null?')
continue;