Skip to main content

Introduction to Zuord

Zuord (from the German word for "assign" or "map") is a TypeScript-first utility library for transforming structured objects, offering fully synchronized type inference β€” at both runtime and compile time.

"Zuord starts where other libraries set their limits. With its schema-less architecture, it provides practical solutions to complex problems that many existing tools struggle with. In terms of performance, type inference, and usability, it technically outshines most of its competitors."

k4yr2 β€” Zuord Creator

Harmony Between Runtime and Type Transformations​

Zuord provides a fully synchronized API for both runtime behavior and compile-time types.

Each transformation is available in two aligned forms:

  • zuord: Runtime functions β€” integrate, merge, evolve, pick, omit, etc.
  • Zuord: Type-level utilities β€” Integrate, Merge, Evolve, Pick, Omit, etc.

Top-tier compiler experience with zero runtime overhead​

Unlike other libraries, Zuord aims to provide a compiler experience that perfectly aligns with runtime behavior, without any runtime overhead.

Smarter Manipulations & Inferences​

Zuord delivers smarter and more precise runtime manipulations and compile-time type inferences compared to native implementations and popular alternatives. Here’s why Zuord stands out:

  • Recursive by Nature
    Zuord operates recursively, applying deep operations across all levels by default:

    const foo = { a: { b: { x: "zuord", y: "is" } } };
    const bar = { a: { b: { z: "cool" as const } } };

    const out = zuord.merge([foo, bar]);

    // Value: { a: { b: { x: "zuord", y: "is", z: "cool" } } }
    // Type: { a: { b: { x: string, y: string, z: "cool" } } }
  • Special Behaviors
    Zuord includes built-in special behaviors, designed to match real-world use cases.

    For example, the merge operation concatenates arrays by default:

    const foo = { h: ["zuord", "is"], l: [2, [2, 2]] };
    const bar = { h: ["cool"], l: [4, [5, 6]] };

    const out = zuord.merge([foo, bar]);

    // Zuord behavior: { h: ["zuord", "is", "cool"], l: [2, [2, 2], 4, [5, 6]] }
    // Other libraries: { h: ["cool"], l: [4, [5, 6]] } (overridden)

    Explore all Special Behaviors in detail.

  • Configurable Usage
    Zuord enables you to override default behaviors according to your specific use cases.

    const foo = { a: { b: { x: "zuord", y: "is" } }, l: [2, [2, 2]] };
    const bar = { a: { b: { z: "cool" as const } }, l: [4, [5, 6]] };

    const options: Zuord.MergeOptions = { shallow: true, concat : false }

    const out = zuord.merge([foo, bar], options);

    // Value: { a: { b: { z: "cool" } }, l: [4, [5, 6]] }
    // Type: { a: { b: { z: "cool" } }, l: (number | number[])[] }