Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// BEGIN-SNIPPET quickstart-validations.js
import {
validatePresence,
validateLength,
validateInclusion
} from "ember-changeset-validations/validators";
export default {
firstName: [validatePresence(true), validateLength({ min: 3, max: 40 })],
lastName: [validatePresence(true), validateLength({ min: 3, max: 40 })],
aboutMe: [validateLength({ allowBlank: true, max: 200 })],
country: [validatePresence(true)],
gender: [validatePresence(true)],
terms: [
validateInclusion({
list: [true],
message: "Please accept the terms and conditions!"
})
],
color: [validatePresence(true)]
};
// END-SNIPPET
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
import validateSometimes from 'ember-changeset-conditional-validations/validators/sometimes';
export default {
paymentMethod: validatePresence(true),
creditCardNumber: validateSometimes([
validatePresence(true),
validateLength({ is: 16 })
], function() {
return this.get('paymentMethod') === 'credit-card';
})
};
import Component from '@ember/component';
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
const rulez = {
firstName: [
validatePresence(true),
validateLength({ min: 2 })
],
lastName: [
validatePresence(true),
validateLength({ min: 2 })
]
};
const schema = {
firstName: null,
lastName: null
};
export default Component.extend({
rulez,
schema
});
import {
validatePresence,
validateLength
} from "ember-changeset-validations/validators";
export default {
description: [validateLength({ max: 300 })],
file: [validatePresence(true)]
};
dcpCommunityboardrecommendation: validatePresence({
presence: false,
message: recommendationPresenceMessage,
}),
};
export const boroughPresidentDispositionValidations = {
...dispositionValidations,
dcpBoroughpresidentrecommendation: validatePresence({
presence: true,
message: recommendationPresenceMessage,
}),
dcpBoroughboardrecommendation: validatePresence({
presence: false,
message: recommendationPresenceMessage,
}),
dcpCommunityboardrecommendation: validatePresence({
presence: false,
message: recommendationPresenceMessage,
}),
};
import {
validatePresence,
validateLength
} from "ember-changeset-validations/validators";
export default {
name: [validatePresence(true), validateLength({ max: 40 })],
description: [validateLength({ max: 4000 })],
team: [validatePresence(true)]
};
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
import config from 'consul-ui/config/environment';
export default Object.assign(
{
SourceName: [validatePresence(true), validateLength({ min: 1 })],
DestinationName: [validatePresence(true), validateLength({ min: 1 })],
Action: validatePresence(true),
},
config.CONSUL_NAMESPACES_ENABLED
? {
SourceNS: [validatePresence(true), validateLength({ min: 1 })],
DestinationNS: [validatePresence(true), validateLength({ min: 1 })],
}
: {}
);
import { validatePresence, validateLength } from 'ember-changeset-validations/validators';
export default {
Name: [validatePresence(true), validateLength({ min: 1 })],
Type: validatePresence(true),
};
message: maxLengthMessage,
}),
validatePresenceUnlessValue({
presence: true,
unless: 'dcpCommunityboardrecommendation',
value: 717170008,
message: numberMessage,
}),
validateNumber({
positive: true,
allowBlank: true,
message: numberMessage,
}),
],
dcpBoroughpresidentrecommendation: validatePresence({
presence: false,
message: recommendationPresenceMessage,
}),
dcpBoroughboardrecommendation: validatePresence({
presence: false,
message: recommendationPresenceMessage,
}),
dcpCommunityboardrecommendation: validatePresence({
presence: true,
message: recommendationPresenceMessage,
}),
};
export const boroughBoardDispositionValidations = {