UNPKG

test-openapi

Version:
44 lines (24 loc) 1.05 kB
"use strict";require("core-js/modules/es.array.iterator");require("core-js/modules/es.string.replace");Object.defineProperty(exports,"__esModule",{value:true});exports.getSpecialValues=void 0;var _crawl=require("../../../utils/crawl.js"); const getSpecialValues=function({call}){ const specialValues=initSpecialValues(); const callA=(0,_crawl.crawl)(call,evalNode.bind(null,specialValues)); return{call:callA,specialValues}; };exports.getSpecialValues=getSpecialValues; const initSpecialValues=function(){ const specialValues=SPECIAL_VALUES.map(specialValue=>({ [specialValue]:[]})); return Object.assign({},...specialValues); }; const evalNode=function(specialValues,value,path){ if(ESCAPED_VALUES.includes(value)){ return value.replace(ESCAPING_CHAR,""); } if(!SPECIAL_VALUES.includes(value)){ return value; } specialValues[value].push(path); }; const SPECIAL_VALUES=["valid","invalid"]; const ESCAPING_CHAR="\\"; const ESCAPED_VALUES=SPECIAL_VALUES.map(value=>`${ESCAPING_CHAR}${value}`); //# sourceMappingURL=special.js.map