Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return true;
}
let result = validate('presence', value, options, null, key);
if (typeof result === 'boolean' || typeof result === 'string') {
return result;
} else {
// We flipped the meaning behind `present` and `blank` so switch the two
if (result.type === 'present') {
result.type = 'blank';
} else if (result.type === 'blank') {
result.type = 'present';
}
return buildMessage(key, result);
}
};
}
}
}
const result = validate('presence', value, options, null, key);
if (typeof result === 'boolean' || typeof result === 'string') {
return result;
}
// We flipped the meaning behind `present` and `blank` so switch the two
if (result.type === 'present') {
result.type = 'blank';
} else if (result.type === 'blank') {
result.type = 'present';
}
return buildMessage(key, result);
};
}
return (key, value) => {
let result = validate('exclusion', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}
return (key, value) => {
if (!hasOptions) {
return true;
}
let result = validate('format', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}
return (key, value) => {
let result = validate('inclusion', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}
return (key, value) => {
let result = validate('number', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}
return (key, newValue, _oldValue, changes/*, _content*/) => {
let result = validate('confirmation', newValue, options, changes, key);
return (result === true) ? true : buildMessage(key, result);
};
}
return (key, newValue) => {
const isValid = bip39.validateMnemonic(newValue);
return isValid || buildMessage(key, { type: 'invalid' }, newValue, options);
};
}
return (key, value) => {
let result = validate('length', value, options, null, key);
return (result === true) ? true : buildMessage(key, result);
};
}