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

x/rimbu/graph/custom/valued/interface/generic/valued-graph-base.ts>ValuedGraphBase.Factory

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface ValuedGraphBase.Factory
import { type ValuedGraphBase } from "https://deno.land/x/rimbu@0.13.5/graph/custom/valued/interface/generic/valued-graph-base.ts";
const { Factory } = ValuedGraphBase;

Type Parameters

optional
UN = unknown

Methods

empty<N extends UN, V>(): WithGraphValues<Tp, N, V>["normal"]

Returns the (singleton) empty instance of this type and context with given key and value types.

of<N extends UN, V>(...graphElements: ArrayNonEmpty<ValuedGraphElement<N, V>>): WithGraphValues<Tp, N, V>["nonEmpty"]

Returns an immutable valued Graph instance containing the graph elements from the given graphElements.

from<N extends UN, V>(...sources: ArrayNonEmpty<StreamSource.NonEmpty<ValuedGraphElement<N, V>>>): WithGraphValues<Tp, N, V>["nonEmpty"]

Returns an immutable valued Graph, containing the graph elements from each of the given sources.

from<N extends UN, V>(...sources: ArrayNonEmpty<StreamSource<ValuedGraphElement<N, V>>>): WithGraphValues<Tp, N, V>["normal"]
builder<N extends UN, V>(): WithGraphValues<Tp, N, V>["builder"]

Returns an empty builder instance.

reducer<N extends UN, V>(source?: StreamSource.NonEmpty<ValuedGraphElement<N, V>>): Reducer<ValuedGraphElement<N, V>, WithGraphValues<Tp, N, V>["normal"]>

Returns a Reducer that adds valued received graph elements to a ValuedGraph and returns the ValuedGraph as a result. When a source is given, the reducer will first create a graph from the source, and then add graph elements to it.