Options
In this section you'll learn how to configure the revival process.
The options are specified as the third argument of the `revive` function.
The structure of the options argument is the following
Option
Description
failOnUnknownFields
If true
the function will throw a `TypeError` exception if an unknown field is found in the schema. A field is unknown if it is not part of the model properties.
failOnMissingFields
If true
the function will throw a TypeError
exception if a model property is not found in the json input.
noNewObjects
If true
the function will not construct new objects based on the schema. Instead it will simply set the prototype to the simple javascript objects created by the JSON.parse
call when parsing the json input. Think Object.setPrototypeOf()
This is useful if you already have an object and you want to assign behavior to it and its nodes.
The default options are the following
Last updated
Was this helpful?