c9482786c1
Replaces Ember's old object model by native ECMAScript classes. Mostly automated with ember-native-class-codemod.
21 lines
521 B
JavaScript
21 lines
521 B
JavaScript
import classic from 'ember-classic-decorator';
|
|
import BaseValidator from 'ember-cp-validations/validators/base';
|
|
|
|
@classic
|
|
export default class ValidCollectionValidator extends BaseValidator {
|
|
validate(value, options) {
|
|
if (options.active === false) {
|
|
return true;
|
|
}
|
|
|
|
const valid = value.every((element) => {
|
|
return element.get('validations.isValid');
|
|
});
|
|
|
|
if (valid) {
|
|
return true;
|
|
} else {
|
|
return this.createErrorMessage('validCollection', options, value);
|
|
}
|
|
}
|
|
}
|