github.com/ethereum-optimism/optimism@v1.7.2/packages/sdk/src/utils/misc-utils.ts (about)

     1  // TODO: A lot of this stuff could probably live in core-utils instead.
     2  // Review this file eventually for stuff that could go into core-utils.
     3  
     4  /**
     5   * Returns a copy of the given object ({ ...obj }) with the given keys omitted.
     6   *
     7   * @param obj Object to return with the keys omitted.
     8   * @param keys Keys to omit from the returned object.
     9   * @returns A copy of the given object with the given keys omitted.
    10   */
    11  export const omit = <T extends object, K extends string | number | symbol>(
    12    obj: T,
    13    ...keys: K[]
    14  ): Omit<T, K> => {
    15    const copy = { ...obj }
    16    for (const key of keys) {
    17      delete copy[key as string]
    18    }
    19    return copy
    20  }