Skip to main content
Module

x/rimbu/mod.ts>Path.getValue

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Path.getValue
import { Path } from "https://deno.land/x/rimbu@0.10.0/mod.ts";
const { getValue } = Path;

Returns the value resulting from selecting the given path in the given source object.

Examples

Example 1

console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b')
// => { c: 5 }
console.log(Path.getValue({ a: { b: { c: 5 } } }), 'a.b.c')
// => 5

Type Parameters

T
optional
P extends Path<T> = Path<T>

Parameters

source: T
  • the object to select in
path: P
  • the path into the object