• Order Properties from an Object

    This function will order the properties of an object based on the provided keys and return a NEW object with the ordered properties.

    Type Parameters

    • Object extends Record<any, any>
    • Keys extends string | number | symbol

    Parameters

    Returns Object

    Example

    import { object } from "@rjweb/utils"

    object.order({ ok: true, e: 0 }, ['e', 'ok']) // { e: 0, ok: true }
    object.order({ ok: true, e: 0, aaa: true }, ['ok', 'e']) // { ok: true, e: 0, aaa: true }

    Since

    1.12.20

    Supports

    nodejs, browser