Skip to content

@graphty/graphty-element / session / renamePaths

Function: renamePaths() ​

renamePaths(where, rename): string

Defined in: graphty-element/src/session/styles/predicate.ts:1335

An expression with some of the paths it reads written another way, everything else kept as it was typed: what a refusal or a check offers as the reader's own rule, corrected, or a rule written with each column under the name a screen shows it by.

ts
import { renamePaths } from "@graphty/graphty-element/session";

renamePaths("graphty.degree > `30`", (path) => (path === "graphty.degree" ? "Degree" : undefined));
// "Degree > `30`"

Parameters ​

where ​

string

The expression.

rename ​

(path) => string | undefined

The new source for a path (given as the rule names it: a bare column name such as minutes, or a dotted path), or undefined to keep it.

Returns ​

string

The rewritten expression.

Throws ​

A GraphtyError with code E_BAD_SELECTOR for an expression that does not lex.

Since ​

3.35.0