Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/lib/node_modules/strapi/node_modules/yup/es/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import printValue from './util/printValue';
var strReg = /\$\{\s*(\w+)\s*\}/g;
var replace = function replace(str) {
return function (params) {
return str.replace(strReg, function (_, key) {
return printValue(params[key]);
});
};
};
export default function ValidationError(errors, value, field, type) {
var _this = this;
this.name = 'ValidationError';
this.value = value;
this.path = field;
this.type = type;
this.errors = [];
this.inner = [];
if (errors) [].concat(errors).forEach(function (err) {
_this.errors = _this.errors.concat(err.errors || err);
if (err.inner) _this.inner = _this.inner.concat(err.inner.length ? err.inner : err);
});
this.message = this.errors.length > 1 ? this.errors.length + " errors occurred" : this.errors[0];
if (Error.captureStackTrace) Error.captureStackTrace(this, ValidationError);
}
ValidationError.prototype = Object.create(Error.prototype);
ValidationError.prototype.constructor = ValidationError;
ValidationError.isError = function (err) {
return err && err.name === 'ValidationError';
};
ValidationError.formatError = function (message, params) {
if (typeof message === 'string') message = replace(message);
var fn = function fn(params) {
params.path = params.label || params.path || 'this';
return typeof message === 'function' ? message(params) : message;
};
return arguments.length === 1 ? fn : fn(params);
}; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |