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

x/rimbu/core/main/index.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.13.1/core/main/index.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