typia
Version:
Superfast runtime validators with only one line
17 lines (15 loc) • 495 B
JavaScript
const _validateReport = (array) => {
const reportable = (path) => {
if (array.length === 0)
return true;
const last = array[array.length - 1].path;
return path.length > last.length || last.substring(0, path.length) !== path;
};
return (exceptable, error) => {
if (exceptable && reportable(error.path))
array.push(error);
return false;
};
};
export { _validateReport };
//# sourceMappingURL=_validateReport.mjs.map