Closed andersonba closed 1 year ago
This feature remove all non-matching properties from original JSON object.
How to use: additionalProperties: 'remove'
additionalProperties: 'remove'
See bellow:
// Schema { str: { type: 'string' }, additionalProperties: 'remove' }
// Object { str: 'hi', extra: 'unimportant data, discard this', extra1: 'discard this' }
// Result object (after validate): { str: 'hi' }
// Getting result object newObject = schema.validate(Object); // or schema.validate(Object, function(err, obj) { newObject = obj; });
Obs.: I moved to new branch, because I needed merge my features in master.
This feature remove all non-matching properties from original JSON object.
How to use:
additionalProperties: 'remove'
See bellow:
Obs.: I moved to new branch, because I needed merge my features in master.