Function: applyDefaultValue()
applyDefaultValue(
obj
,schema
):any
Defined in: schema/helpers/fn-schema.ts:196
Apply default values defined on schema to an object instance.
Parameters
obj
any
reference to object instance
schema
definition will be used to determine default definitions
Schema
| SchemaDef
Returns
any
Example
const schema = { name: { type: String, default: 'John' }, hasChild: { type: Boolean, default: true } };
const obj: any = applyDefaultValue(obj, schema)
console.log(obj);