let current: Record<string, unknown> | unknown[] = obj; for (let i = 0; i < path.length - 1; i += 1) { const key = path[i]; const nextKey = path[i + 1]; if (typeof key === "number") { if (!Array.isArray(current)) { returnnull;
} if (current[key] == null) { if (!createMissing) { returnnull;
}
current[key] = typeof nextKey === "number" ? [] : ({} as Record<string, unknown>);
}
current = current[key] as Record<string, unknown> | unknown[]; continue;
}
if (typeof current !== "object" || current == null) { returnnull;
} const record = current as Record<string, unknown>; if (record[key] == null) { if (!createMissing) { returnnull;
}
record[key] = typeof nextKey === "number" ? [] : ({} as Record<string, unknown>);
}
current = record[key] as Record<string, unknown> | unknown[];
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.