test-openapi
Version:
Automated client requests
35 lines (19 loc) • 520 B
JavaScript
Object.defineProperty(exports,"__esModule",{value:true});exports.getPath=void 0;
const getPath=function(parts){
return parts.map(getPart).join("");
};exports.getPath=getPath;
const getPart=function(part,index){
if(Number.isInteger(part)){
return`[${part}]`;
}
const partA=String(part);
if(!VALID_JS_NAME.test(partA)){
return`[${JSON.stringify(partA)}]`;
}
if(index===0){
return partA;
}
return`.${partA}`;
};
const VALID_JS_NAME=/^[A-Za-z][\$0-9A-Z_a-z]*$/u;
//# sourceMappingURL=path.js.map
;