define()
Register a named restore definition.
Import
Section titled “Import”import { define } from "@graphrefly/ts/operators";Signature
Section titled “Signature”function define( ref: string, fn: (v: S) => T, opts: DefineOpts = {},): Definition<S, T>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ref | string | Stable restore reference name. |
fn | (v: S) => T | Pure transform function used during restoration. |
opts | DefineOpts | Optional registry to receive the new definition. |
Returns
Section titled “Returns”A named definition record.
Example
Section titled “Example”define("trim", (value: string) => value.trim());Source
Section titled “Source”packages/ts/src/graph/operators.ts