konditions
Version:
A simple and customizable JSON-based condition engine in TypeScript (e.g. GreaterThan, StringLike, Every, Some)
40 lines • 1.34 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeUnexpectedFailedResolution = exports.makeValidationFailedResolution = exports.makeUnuccessfulResolution = exports.makeSuccessfulResolution = exports.makeResolution = void 0;
const makeResolution = (passed) => {
return passed ? exports.makeSuccessfulResolution() : exports.makeUnuccessfulResolution();
};
exports.makeResolution = makeResolution;
const makeSuccessfulResolution = () => {
return {
passed: true,
};
};
exports.makeSuccessfulResolution = makeSuccessfulResolution;
const makeUnuccessfulResolution = () => {
return {
passed: false,
};
};
exports.makeUnuccessfulResolution = makeUnuccessfulResolution;
const makeValidationFailedResolution = (reasons = []) => {
return {
passed: false,
error: {
type: `ValidationError`,
reasons,
},
};
};
exports.makeValidationFailedResolution = makeValidationFailedResolution;
const makeUnexpectedFailedResolution = () => {
return {
passed: false,
error: {
type: `UnexpectedError`,
message: `We encountered an unexpected error.`,
},
};
};
exports.makeUnexpectedFailedResolution = makeUnexpectedFailedResolution;
//# sourceMappingURL=resolution.factories.js.map
;