API Reference
define()
Register a named restore definition.
Import
import { define } from "@graphrefly/ts/operators";
Signature
function define(
ref: string,
fn: (v: S) => T,
opts: DefineOpts = {},
): Definition<S, T>
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
A named definition record.
Example
define("trim", (value: string) => value.trim());
Source
packages/ts/src/graph/operators.ts