Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "common-keys"

Index

Functions

Const commonKeysMap

  • commonKeysMap<K>(a: Map<K, any>, b: Map<K, any>, out?: K[]): K[]
  • Like commonKeysObj(), but for ES6 Maps.

    Type parameters

    • K

    Parameters

    • a: Map<K, any>
    • b: Map<K, any>
    • Default value out: K[] = []

    Returns K[]

Const commonKeysObj

  • commonKeysObj<A, B>(a: A, b: B, out?: string[]): (keyof A & keyof B)[]
  • Returns array of keys present in both args, i.e. the set intersection of the given objects' key / property sets.

    commonKeys({ a: 1, b: 2 }, { c: 10, b: 20, a: 30 })
    // [ "a", "b" ]

    Type parameters

    • A

    • B

    Parameters

    • a: A
    • b: B
    • Default value out: string[] = []

    Returns (keyof A & keyof B)[]

Generated using TypeDoc