@adviser/cement - v0.0.0
    Preparing search index...

    Function toSortedObject

    • Returns a new object with keys sorted alphabetically.

      Creates a shallow copy of the object with keys in sorted order. Useful for deterministic serialization or comparison.

      Type Parameters

      • T extends {}

        The input object type

      • S

        Base type for non-null assertion

      Parameters

      • Optionalset: T

        The object to sort

      • OptionaltouchFn: TouchFn

        Optional function to transform values during sorting

      Returns T | undefined

      New object with sorted keys, or undefined if input is null/undefined

      const sorted = toSortedObject({ z: 3, a: 1, m: 2 });
      // { a: 1, m: 2, z: 3 }
      Object.keys(sorted); // ['a', 'm', 'z']