Function permute

  • Returns a permutation of the specified source object (or array) using the specified iterable of keys. The returned array contains the corresponding property of the source object for each key in keys, in order. For example, permute(["a", "b", "c"], [1, 2, 0]) // ["b", "c", "a"]

    It is acceptable to have more keys than source elements, and for keys to be duplicated or omitted.

    Type Parameters

    • T

    Parameters

    • source: {
          [key: number]: T;
      }
      • [key: number]: T
    • keys: Iterable<number>

    Returns T[]

  • Extract the values from an object into an array with a stable order. For example: var object = {yield: 27, year: 1931, site: "University Farm"}; d3.permute(object, ["site", "yield"]); // ["University Farm", 27]

    Type Parameters

    • T

    • K extends string | number | symbol

    Parameters

    • source: T
    • keys: Iterable<K>

    Returns T[K][]