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 has from "lodash-es/has";
import isSchema from './util/isSchema';
var Condition =
/*#__PURE__*/
function () {
function Condition(refs, options) {
this.refs = refs;
if (typeof options === 'function') {
this.fn = options;
return;
}
if (!has(options, 'is')) throw new TypeError('`is:` is required for `when()` conditions');
if (!options.then && !options.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
var is = options.is,
then = options.then,
otherwise = options.otherwise;
var check = typeof is === 'function' ? is : function () {
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
values[_key] = arguments[_key];
}
return values.every(function (value) {
return value === is;
});
};
this.fn = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var options = args.pop();
var schema = args.pop();
var branch = check.apply(void 0, args) ? then : otherwise;
if (!branch) return undefined;
if (typeof branch === 'function') return branch(schema);
return schema.concat(branch.resolve(options));
};
}
var _proto = Condition.prototype;
_proto.resolve = function resolve(base, options) {
var values = this.refs.map(function (ref) {
return ref.getValue(options);
});
var schema = this.fn.apply(base, values.concat(base, options));
if (schema === undefined || schema === base) return base;
if (!isSchema(schema)) throw new TypeError('conditions must return a schema object');
return schema.resolve(options);
};
return Condition;
}();
export default Condition; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0052 ]-- |