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

x/rimbu/deep/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@1.2.0/deep/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 }

Type Parameters

T
SL extends Selector<T>

Parameters

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

Returns

Selector.Result<T, SL>