MCPcopy Index your code
hub / github.com/codecombat/codecombat / getValidationErrors

Method getValidationErrors

app/models/CocoModel.js:187–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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()

Callers 3

validateMethod · 0.95
onSubmitFormMethod · 0.80
commitLevelMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected