Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/rimbu/table/custom/index.ts>TableBase.Builder

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface TableBase.Builder
import { type TableBase } from "https://deno.land/x/rimbu@1.0.0/table/custom/index.ts";
const { Builder } = TableBase;

Properties

readonly
size: number

Returns the amount of entries in the builder.

readonly
isEmpty: boolean

Returns true if there are no entries in the builder.

readonly
amountRows: number

Returns the amount of rows in the builder.

Methods

get<UR = R, UC = C>(row: RelatedTo<R, UR>, column: RelatedTo<C, UC>): V | undefined

Returns the value at given row and column keys, or the otherwise value if no value is present.

get<UR, UC, O>(
row: RelatedTo<R, UR>,
column: RelatedTo<C, UC>,
otherwise: OptLazy<O>,
): V | O
getRow<UR = R>(row: RelatedTo<R, UR>): WithRow<Tp, R, C, V>["row"]

Returns a map containing the column keys and values in the given row.

hasValueAt<UR = R, UC = C>(row: RelatedTo<R, UR>, column: RelatedTo<C, UC>): boolean

Returns true if the builder has a value for given row and column keys.

hasRowKey<UR = R>(row: RelatedTo<R, UR>): boolean

Returns true if given row key is in the builder.

set(
row: R,
column: C,
value: V,
): boolean

Sets the given value for the given row and column keys in the builder.

addEntry(entry: readonly [R, C, V]): boolean

Adds the given entry to the builder.

addEntries(entries: StreamSource<readonly [R, C, V]>): boolean

Adds the given entries to the builder.

remove<UR = R, UC = C>(row: RelatedTo<R, UR>, column: RelatedTo<C, UC>): V | undefined

Remove the value at given row and column keys in the builder.

remove<UR, UC, O>(
row: RelatedTo<R, UR>,
column: RelatedTo<C, UC>,
otherwise: OptLazy<O>,
): V | O
removeRow<UR = R>(row: RelatedTo<R, UR>): boolean

Removes all values in the given row from the builder.

removeRows<UR = R>(rows: StreamSource<RelatedTo<R, UR>>): boolean

Removes all given rows from the builder.

removeEntries<UR = R, UC = C>(entries: StreamSource<[RelatedTo<R, UR>, RelatedTo<C, UC>]>): boolean

Removes all given entries from the builder.

forEach(f: (
entry: [R, C, V],
index: number,
halt: () => void,
) => void
, state?: TraverseState
): void

Performs given function f for each entry of the collection, using given state as initial traversal state.

modifyAt(
row: R,
column: C,
options: { ifNew?: OptLazyOr<V, Token>; ifExists?: (currentValue: V, remove: Token) => V | Token; },
): boolean

Modifies the value at given row and column keys according to given options.

updateAt(
row: R,
column: C,
update: Update<V>,
): V | undefined

Updates the value at given row and column keys according to the given update function.

updateAt<O>(
row: R,
column: C,
update: Update<V>,
otherwise: OptLazy<O>,
): V | O
build(): WithRow<Tp, R, C, V>["normal"]

Returns an immutable collection instance containing the entries in this builder.

buildMapValues<V2>(mapFun: (
value: V,
row: R,
column: C,
) => V2
): (Tp & Row<R, C, V2>)["normal"]

Returns an immutable collection instance containing the entries in this builder.