docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Utilities that merge, clone, and compare workspace configuration objects using custom deep behavior rather than default structural rules.
{ plugins: ["core", "ui"] } merged with incoming { plugins: ["ui", "admin", "core"] } results in { plugins: ["core", "ui", "admin"] } while leaving unrelated properties unchanged. @test{ retries: 2, metadata: { last: "ok" } } merged with incoming { retries: null, metadata: { last: null, status: "warn" } } produces { retries: 2, metadata: { last: "ok", status: "warn" } }, ignoring null overrides but keeping new keys. @test{ featureFlags: [{ id: "a", active: false }, { id: "b", active: true }] } merged with incoming { featureFlags: [{ id: "a", active: true }, { id: "c", active: true }] } yields { featureFlags: [{ id: "a", active: true }, { id: "b", active: true }, { id: "c", active: true }] }. @test{ lastSync: new Date("2024-03-01T10:00:00Z"), plugins: new Set(["core", "ui"]), transform: fn } returns { lastSync: "2024-03-01T10:00:00.000Z", plugins: ["core", "ui"], transform: fn } where the date becomes an ISO string, the set becomes an alphabetically sorted array, and the function reference is preserved. @test{ plugins: ["ui", "core"], retries: 2.005, lastSync: new Date("2024-03-01T10:00:00Z") } with { plugins: ["core", "ui", "core"], retries: 2.0, lastSync: "2024-03-01T10:00:00.000Z" } returns true because plugin order and duplicates are ignored, numeric differences within 0.01 are tolerated, and dates match their ISO string. @test{ plugins: ["core"], retries: 2 } with { plugins: ["core", "reports"], retries: 2.2 } returns false because of the missing plugin and numeric gap above the tolerance. @testexport interface FeatureFlag {
id: string;
active: boolean;
[key: string]: unknown;
}
export interface WorkspaceConfig {
plugins?: string[] | Set<string>;
retries?: number | null;
featureFlags?: FeatureFlag[];
lastSync?: Date | string | null;
metadata?: Record<string, unknown>;
transform?: () => void;
custom?: unknown;
}
export function mergeConfigs(base: WorkspaceConfig, incoming: WorkspaceConfig): WorkspaceConfig;
export function cloneForTransport(config: WorkspaceConfig): WorkspaceConfig;
export function configsEquivalent(a: WorkspaceConfig, b: WorkspaceConfig): boolean;Utility toolkit for deep cloning, merging, and comparisons with custom traversal hooks. @satisfied-by