Home > scrubbr > ScrubbrState

ScrubbrState class

Signature:

export declare class ScrubbrState 

Constructors

Constructor Modifiers Description
(constructor)(data, schema, options, context, path, nesting) Constructs a new instance of the ScrubbrState class

Properties

Property Modifiers Type Description
context any The context object passed to the serialize function.
index number | null If we're currently serializing an array, this is the array index
logger Logger
name string The property name of the data being serialized.
nesting number The nesting level at this node of the data being serialized.
options ScrubbrOptions
originalData any Unserialized data at this node.
parent ScrubbrState | null The state of the parent node
path string The current object path
rootSchemaType string The schema type we're serializing the document with.
schemaDef JSONSchema7 JSON Schema object of the current data node type.
schemaType string | null The schema type of the current data node.
seenTypes string[] The schema types that have been used to serialize this node.

Methods

Method Modifiers Description
createListState(data, index, path, schema) Create a child array index state, derived off of this state.
createNodeState(data, name, path, schema) Create a child property node state, derived off of this state.