Skip to main content
Module

x/fae/mod.ts>paths

A functional module for Deno inspired from Ramda.
Latest
variable paths
import { paths } from "https://deno.land/x/fae@v1.1.1/mod.ts";

Retrieves the values at given paths pathsArr of obj. Each path in the pathsArr may be any array of keys or string of keys separated by / or . .

 Fae.paths([['a', 'b'], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); // [2, 3]
 Fae.paths([['a', 'b'], ['p', 'r']], {a: {b: 2}, p: [{q: 3}]}); // [2, undefined]
 Fae.paths([[], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); // [ { a: { b: 2 }, p: [ { q: 3 } ] }, 3 ]
 Fae.paths([['a', ''], ['p', 0, 'q']], {a: {b: 2}, p: [{q: 3}]}); // [ undefined, 3 ]

type

Paths