a schema for the property
Gets the value of the property from the object.
an object containing a value and success properties. value is the value of the property
if it was found in the object, success is a boolean value indicating if the property was found in the object.
Sets a new value to the property. If the process was successful,
the method returns true, otherwise false.
It can return false if the property could not be set to the object
which can happen if the setValue method is called with an object
which does not comply with the schema.
for example, if you have a schema and property descriptopr like this:
const schema = object({
name: string(),
address: object({
city: string(),
country: string()
}),
id: number()
});
const addressCityDescriptor = object.getPropertiesFor(schema).address.city;
And then you try to set a new value to the address.city property on the object
which does not have address property:
const obj = {
name: 'Leo'
};
const success = addressCityDescriptor.setValue(obj, 'Venyov');
// success === false
Object to set the value to
a new value to set to the property
Optionaloptions: PropertySetterOptionsadditional optional parameters to control the process
Gets the schema for the property described by the property descriptor.