()
| 185 | schema () { return this.constructor.schema } |
| 186 | |
| 187 | getValidationErrors () { |
| 188 | // Since Backbone unset only sets things to undefined instead of deleting them, we ignore undefined properties. |
| 189 | const definedAttributes = _.pick(this.attributes, v => v !== undefined) |
| 190 | const { |
| 191 | errors, |
| 192 | } = tv4.validateMultiple(definedAttributes, this.constructor.schema || {}) |
| 193 | if (errors != null ? errors.length : undefined) { return errors } |
| 194 | } |
| 195 | |
| 196 | validate () { |
| 197 | const errors = this.getValidationErrors() |
no outgoing calls
no test coverage detected