Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rambda/rambda.js>path

Faster and smaller alternative to Ramda
Latest
function path
import { path } from "https://deno.land/x/rambda@9.4.1/rambda.js";

If pathToSearch is 'a.b' then it will return 1 if obj is {a:{b:1}}.

It will return undefined, if such path is not found.

Type Parameters

S
optional
K0 extends keyof S = keyof S

Parameters

path: [K0]
obj: S

Type Parameters

S
optional
K0 extends keyof S = keyof S
optional
K1 extends keyof S[K0] = keyof S[K0]

Parameters

path: [K0, K1]
obj: S

Type Parameters

S
optional
K0 extends keyof S = keyof S
optional
K1 extends keyof S[K0] = keyof S[K0]
optional
K2 extends keyof S[K0][K1] = keyof S[K0][K1]

Parameters

path: [K0, K1, K2]
obj: S

Type Parameters

S
optional
K0 extends keyof S = keyof S
optional
K1 extends keyof S[K0] = keyof S[K0]
optional
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
optional
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2]

Parameters

path:
[
K0,
K1,
K2,
K3,
]
obj: S

Type Parameters

S
optional
K0 extends keyof S = keyof S
optional
K1 extends keyof S[K0] = keyof S[K0]
optional
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
optional
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2]
optional
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3]

Parameters

path:
[
K0,
K1,
K2,
K3,
K4,
]
obj: S

Type Parameters

S
optional
K0 extends keyof S = keyof S
optional
K1 extends keyof S[K0] = keyof S[K0]
optional
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
optional
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2]
optional
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3]
optional
K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4]

Parameters

path:
[
K0,
K1,
K2,
K3,
K4,
K5,
]
obj: S

Parameters

pathToSearch: string
obj: any

Returns

T | undefined

Parameters

pathToSearch: string

Returns

(obj: any) => T | undefined

Parameters

pathToSearch: RamdaPath

Returns

(obj: any) => T | undefined

Parameters

pathToSearch: RamdaPath
obj: any

Returns

T | undefined