blog infra

This commit is contained in:
Emergent Reasons
2025-10-16 06:23:59 +00:00
parent 4740d39105
commit 0841917e09
16 changed files with 2703 additions and 190 deletions
+7 -2
View File
@@ -83,10 +83,15 @@ export function findAllKeyOcurrences(
const keyValues: Array<unknown> = [];
function traverse(currentObj: Record<string | number | symbol, unknown>, depth: number = 0) {
function traverse(
currentObj: Record<string | number | symbol, unknown>,
depth: number = 0,
) {
// Stop if depth exceeds the amount of 'allowedNestedLevels'.
if (depth > allowedNestedLevels)
throw new Error(`Maximum nesting level of ${allowedNestedLevels} reached.`);
throw new Error(
`Maximum nesting level of ${allowedNestedLevels} reached.`,
);
// Stop when find a non object value.
if (typeof currentObj !== 'object' || currentObj === null) return;