test-openapi
Version:
Automated client requests
39 lines (25 loc) • 837 B
JavaScript
;Object.defineProperty(exports,"__esModule",{value:true});exports.parseInput=void 0;var _crawl=require("../utils/crawl.js");
var _common=require("./common.js");
const parseInput=function(taskOrConfig,throwError){
return(0,_crawl.crawl)(
taskOrConfig,
(value,path)=>parseInputValue({value,path,throwError}),
{topDown:true});
};exports.parseInput=parseInput;
const parseInputValue=function({value,path,throwError}){
if(value===_common.UNDEFINED){
return undefined;
}
if(value===_common.ESCAPED_UNDEFINED){
return _common.UNDEFINED;
}
if(isAllowed(value)){
return value;
}
const message=(0,_common.getMessage)({value,path});
throwError({message,value,path});
};
const isAllowed=function(value){
return(0,_common.isJsonType)(value)||value===undefined||typeof value==="function";
};
//# sourceMappingURL=input.js.map