@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 958 B
JavaScript
function isRecord(value) {
return typeof value === "object" && value !== null && !Array.isArray(value);
}
/**
* The override layer without `field` (or only `field.nestedKey`), so an explicit
* setter for that key wins over a CLI/programmatic override while every other
* override keeps applying. Empty parents are dropped; the input is not mutated.
*/
export function withoutOverride(overrides, field, nestedKey) {
if (!(field in overrides))
return overrides;
const next = { ...overrides };
const current = next[field];
if (nestedKey === undefined || !isRecord(current)) {
delete next[field];
return next;
}
if (!(nestedKey in current))
return overrides;
const nested = { ...current };
delete nested[nestedKey];
if (Object.keys(nested).length === 0)
delete next[field];
else
next[field] = nested;
return next;
}
//# sourceMappingURL=settings-overrides.js.map