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

x/rimbu/deep/selector.ts>select

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function select
import { select } from "https://deno.land/x/rimbu@0.13.5/deep/selector.ts";

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.select(item, { q: 'a.c', y: ['a.b', 'a.c'], z: (v) => v.a.b + 1 });
// => { q: 'a', y: [1, 'a'], z: 2 }

Parameters

source: T
  • the source value to select from
selector: Selector.Shape<SL>
  • a shape indicating the selection from the source values