• Tiny helper to do the minimal amount of work in duplicating an object but omitting some props. This ends up faster than using object ...rest or reduce to filter.

    This behaves very much like filteredAssign, but does not merge many objects together, uses an exclusion object map, and avoids spreads all for optimal performance.

    See perf test for background: https://jsperf.com/omit-vs-rest-vs-reduce/1

    Type Parameters

    • TObj extends Record<string, any>
    • Exclusions extends (keyof TObj)[]

    Parameters

    • obj: TObj

      The object to clone

    • exclusions: Exclusions

      The array of keys to exclude

    Returns Omit<TObj, Exclusions[number]>