Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "common-keys"

Index

Functions

Const commonKeysMap

  • commonKeysMap<K>(a: Map<K, any>, b: Map<K, any>, out?: K[]): 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.

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

    Type parameters

    • A: object

    • B: object

    Parameters

    • a: A

      first object

    • b: B

      other object

    • Default value out: string[] = []

      result array

    Returns (keyof A & keyof B)[]

Generated using TypeDoc