Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "indexed"

Index

Functions

Functions

Const indexed

  • indexed<T>(records: Iterable<T>, ks: keyof T[]): EquivMap<{}, Set<T>>
  • Takes an iterable of plain objects and array of indexing keys. Calls selectKeysObj on each value and uses returned objects as new keys to group original values. Returns a new EquivMap of sets.

    example
    indexed(
      new Set([{a: 1, b: 1}, {a: 1, b: 2}, {a: 1, b: 1, c: 2}]),
      ["a","b"]
    )
    // EquivMap {
    //   { a: 1, b: 1 } => Set { { a: 1, b: 1 }, { a: 1, b: 1, c: 2 } },
    //   { a: 1, b: 2 } => Set { { a: 1, b: 2 } } }

    Type parameters

    • T: object

    Parameters

    • records: Iterable<T>

      objects to index

    • ks: keyof T[]

      keys used for indexing

    Returns EquivMap<{}, Set<T>>

Generated using TypeDoc