GraphReFlyTS

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

ParameterTypeDescription
refstringStable restore reference name.
fn(v: S) => TPure transform function used during restoration.
optsDefineOptsOptional 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