@pengzhanbo/utils - v3.7.3
    Preparing search index...

    Function clearUndefined

    • Remove keys with undefined values from an object

      从对象中删除值为 undefined 的键

      Type Parameters

      • T extends object

        The type of elements in the array / 数组元素的类型

      Parameters

      • obj: T

        The object to remove undefined keys from / 要删除值为 undefined 键的对象

      Returns T

      The object with undefined keys removed / 移除了值为 undefined 键的对象

      This function mutates the original object in place by deleting keys whose value is undefined. It does not create a copy.

      此函数会直接修改原对象,删除值为 undefined 的键。不会创建副本。

      const obj = { a: 1, b: undefined }
      clearUndefined(obj) // { a: 1 }