Skip to main content
Module

x/rimbu/mod.ts>Deep.select

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Deep.select
import { Deep } from "https://deno.land/x/rimbu@0.13.1/mod.ts";
const { select } = 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.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