mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-23 05:08:11 +00:00
Adds broad inline comments and JSDoc for CLI, cron, outbound/channel, plugin SDK, ACP, shared helpers, net policy, and related utility contracts. Proof: git diff --check on latest exact head plus focused cron tests passed; CI had no failing checks observed before merge attempt.
14 lines
580 B
TypeScript
14 lines
580 B
TypeScript
/** Upper bound for config path array indexes to reject impractical sparse writes. */
|
|
export const MAX_CONFIG_PATH_ARRAY_INDEX = 100_000;
|
|
|
|
const CANONICAL_ARRAY_INDEX_SEGMENT = /^(0|[1-9]\d*)$/;
|
|
|
|
/** Parses a canonical non-negative array index segment used by config and JSON paths. */
|
|
export function parseConfigPathArrayIndex(segment: string): number | undefined {
|
|
if (!CANONICAL_ARRAY_INDEX_SEGMENT.test(segment)) {
|
|
return undefined;
|
|
}
|
|
const index = Number(segment);
|
|
return Number.isSafeInteger(index) && index <= MAX_CONFIG_PATH_ARRAY_INDEX ? index : undefined;
|
|
}
|