Skip to main content
Module

x/rimbu/mod.ts>Deep.selectAt

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

Returns the result of applying the given selector shape to the given source value.

Examples

Example 1

const item = { a: { b:  1, c: 'a' } };
Deep.selectAt(item, 'a', { q: 'c', z: ['b', v => v.b + 1] as const });
// => { q: 'a', z: [1, 2] }

Type Parameters

T
P extends Path.Get<T>
SL extends Selector<Path.Result<T, P>>

Parameters

source: T
  • the source value to select from
path: P
  • the string path in the object
selector: Selector.Shape<SL>
  • a shape indicating the selection from the source value at the given path