UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) 1.2 kB
import { c as isRecord } from "./record-coerce-DItp3I4t.js"; import "./utils-P__uGsPB.js"; import { isDeepStrictEqual } from "node:util"; //#region src/config/config-change-paths.ts function collectChangedPaths(base, target, path, output) { if (Array.isArray(base) && Array.isArray(target)) { const max = Math.max(base.length, target.length); for (let index = 0; index < max; index += 1) { const childPath = path ? `${path}[${index}]` : `[${index}]`; if (index >= base.length || index >= target.length) { output.add(childPath); continue; } collectChangedPaths(base[index], target[index], childPath, output); } return; } if (isRecord(base) && isRecord(target)) { const keys = /* @__PURE__ */ new Set([...Object.keys(base), ...Object.keys(target)]); for (const key of keys) { const childPath = path ? `${path}.${key}` : key; const hasBase = Object.hasOwn(base, key); if (!Object.hasOwn(target, key) || !hasBase) { output.add(childPath); continue; } collectChangedPaths(base[key], target[key], childPath, output); } return; } if (!isDeepStrictEqual(base, target)) output.add(path); } //#endregion export { collectChangedPaths as t };