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

    Function toSortedObjectArray

    • Converts an object to an array of single-key objects, sorted by key.

      Each entry becomes its own object with one key-value pair, useful for serialization formats that need objects instead of tuples.

      Type Parameters

      • T

        The input object type

      Parameters

      • Optionalset: T

        The object to convert

      • OptionaltouchFn: TouchFn

        Optional function to transform values during sorting

      Returns Record<string, unknown>[]

      Array of objects, each with a single key-value pair, sorted by key

      const sorted = toSortedObjectArray({ z: 3, a: 1, m: 2 });
      // [{ a: 1 }, { m: 2 }, { z: 3 }]