@nahkies/typescript-koa-runtime
Version:
Runtime package for code generated by @nahkies/openapi-code-generator using the typescript-koa template
16 lines (15 loc) • 562 B
JavaScript
//#region ../typescript-common-runtime/dist/esm/validation.mjs
function isMatch(status, match) {
return /^\d+$/.test(match) && String(status) === match || /^\d[xX]{2}$/.test(match) && String(status)[0] === match[0];
}
function findMatchingSchema(status, possibleResponses) {
for (const [match, schema] of possibleResponses) if (isMatch(status, match)) return schema;
}
//#endregion
Object.defineProperty(exports, "findMatchingSchema", {
enumerable: true,
get: function() {
return findMatchingSchema;
}
});
//# sourceMappingURL=validation-MwT7R5YJ.cjs.map