Module

x/rambda/immutable.d.ts>indexBy

Faster and smaller alternative to Ramda
Latest
function indexBy
import { indexBy } from "https://dotland.deno.dev/x/rambda@9.4.1/immutable.d.ts";

It generates object with properties provided by condition and values provided by list array.

If condition is a function, then all list members are passed through it.

If condition is a string, then all list members are passed through R.path(condition).

Type Parameters

T
optional
K extends string | number = string

Parameters

condition: (key: T) => K
list: readonly T[]

Returns

readonly [key in K]: T

Type Parameters

T
optional
K extends string | number | undefined = string

Parameters

condition: (key: T) => K
list: readonly T[]

Returns

readonly [key in NonNullable<K>]?: T

Type Parameters

T
optional
K extends string | number = string

Parameters

condition: (key: T) => K

Returns

(list: readonly T[]) => readonly [key in K]: T

Type Parameters

T
optional
K extends string | number | undefined = string

Parameters

condition: (key: T) => K | undefined

Returns

(list: readonly T[]) => readonly [key in NonNullable<K>]?: T

Parameters

condition: string
list: readonly T[]

Returns

{ readonly [key: string]: T; }

Parameters

condition: string

Returns

(list: readonly T[]) => { readonly [key: string]: T; }