You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
957 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
ensure: function() {
return ensure;
},
ensureBoolean: function() {
return ensureBoolean;
}
});
var _type_of = require("@swc/helpers/_/_type_of");
var ensure = function(type, // eslint-disable-next-line @typescript-eslint/no-explicit-any
maybe, fallback) {
var safeTypes = [
type
].flat();
var isValidType = safeTypes.some(function(safeType) {
return (typeof maybe === "undefined" ? "undefined" : _type_of._(maybe)) === safeType;
});
return isValidType ? maybe : fallback;
};
var ensureBoolean = function(// eslint-disable-next-line @typescript-eslint/no-explicit-any
maybe, fallback) {
return ensure("boolean", maybe, fallback);
};