Closed sashapop10 closed 10 months ago
const schema = new Schema({ name: 'string', phrase: (parent, root) => 'Hello ' + parent.name + ' !', }) const mode = true; // true - copy, false - assign; const sample = { name: 'Alexander' }; schema.calc(sample,true); // { result: { name: 'Alexander', phrase: 'Hello Alexander !' } }; sample; // { name: 'Alexander' } schema.calc(sample); // If sample not an object in this mode - throw error sample; // { name: 'Alexander', phrase: 'Hello Alexander !' }
Describe the problem
Calculated schemas another words - Functional fields