@nevware21/ts-utils
    Preparing search index...

    Function objOmit

    • Creates a new object composed of the enumerable own properties of source except for those matching the provided keys.

      Type Parameters

      • T

        The type of the source object

      • K extends string | number | symbol

        The key type (subset of keyof T) to exclude

      Parameters

      • source: T

        The source object to omit from

      • keys: ArrayLike<K>

        The array of keys to exclude

      Returns Pick<T, Exclude<keyof T, K>>

      A new object containing all own enumerable properties of source except those listed in keys. Returns an empty object if source is null or undefined.

      0.14.0

      const obj = { a: 1, b: "hello", c: true };

      objOmit(obj, ["b"]); // { a: 1, c: true }
      objOmit(obj, ["a", "c"]); // { b: "hello" }
      objOmit(obj, []); // { a: 1, b: "hello", c: true }
      objOmit(null, ["a"]); // {}
    • Creates a new object composed of the enumerable own properties of source except for those matching the provided keys.

      Type Parameters

      • T

        The type of the source object

      Parameters

      • source: T

        The source object to omit from

      • keys: ArrayLike<string>

        The array of keys to exclude

      Returns Partial<T>

      A new object containing all own enumerable properties of source except those listed in keys. Returns an empty object if source is null or undefined.

      0.14.0

      const obj = { a: 1, b: "hello", c: true };

      objOmit(obj, ["b"]); // { a: 1, c: true }
      objOmit(obj, ["a", "c"]); // { b: "hello" }
      objOmit(obj, []); // { a: 1, b: "hello", c: true }
      objOmit(null, ["a"]); // {}
    • Creates a new object composed of the enumerable own properties of source except for those matching the provided keys.

      Type Parameters

      • T

        The type of the source object

      Parameters

      • source: T

        The source object to omit from

      • keys: ArrayLike<PropertyKey>

        The array of keys to exclude

      Returns Partial<T>

      A new object containing all own enumerable properties of source except those listed in keys. Returns an empty object if source is null or undefined.

      0.14.0

      const obj = { a: 1, b: "hello", c: true };

      objOmit(obj, ["b"]); // { a: 1, c: true }
      objOmit(obj, ["a", "c"]); // { b: "hello" }
      objOmit(obj, []); // { a: 1, b: "hello", c: true }
      objOmit(null, ["a"]); // {}