Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (parsed, when, value) => {
if (!parsed.scope) {
return [true, ''];
}
const negated = when === 'never';
const result = value.length === 0 || ensure.enum(parsed.scope, value);
return [
negated ? !result : result,
message([
`scope must`,
negated ? `not` : null,
`be one of [${value.join(', ')}]`
])
];
};
export default (parsed, when, value) => {
const {type: input} = parsed;
if (!input) {
return [true];
}
const negated = when === 'never';
const result = ensure.enum(input, value);
return [
negated ? !result : result,
message([
`type must`,
negated ? `not` : null,
`be one of [${value.join(', ')}]`
])
];
};