selection.parse

Check that a JSON value is a selector, naming the clause that is wrong.

Value helperSince 0.5.0

Usage

TypeScript
Selection.parse(json: unknown, use?: "param" | "query"): Result<GeometrySelector>

Parameters

  • jsonunknown

    The candidate selector, e.g. { where: { extremal: "+y" } }.

    Required

  • use"param" | "query"

    A graph parameter is stricter: no pid (ids are not carried through every operation), and not only around normal. Default "query".

Returns

Ok with the selector unchanged.

Errors

Example

TypeScript
Selection.parse({ where: { normal: "+w" } }).diagnostics[0].paramPath // → 'where.normal'

See also