Context given to the valueTransformer function of the transform method.

It provides some metadata for the current value to transform. The remove() method can be used to complete hide the current value from the target instance.

interface TransformContext {
    keepAsIs(): symbol;
    parents: readonly any[];
    path: readonly (string | number | symbol)[];
    remove(): symbol;
}

Properties

Methods

Properties

parents: readonly any[]

The parent objects of the current value.

path: readonly (string | number | symbol)[]

The property path from the root object to the current value.

Entries represent the path taken (property names, indices) to reach the current value.

This array has the same length and the same order as parents.

Methods

  • Can be used by a value transformer to inform the transformer method about keeping the current value untouched. This is helpful to supports complex class instances or skipping the default clone behavior.

    Returns symbol

  • Can be used by a value transformer to inform the transformer method about removing the current value.

    Returns symbol