axios-mock-server
Version:
RESTful mock server using axios
31 lines • 1.11 kB
JavaScript
;
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (path, relativePath) {
var values = {};
var dirList = path.split('/');
var parsedRequestUrl = relativePath.split('/');
parsedRequestUrl.forEach(function (dir, i) {
if (dirList[i].startsWith('_')) {
var _a = __read(dirList[i].slice(1).split('@'), 2), valueName = _a[0], _b = _a[1], type = _b === void 0 ? 'number' : _b;
values[valueName] = isNaN(+dir) || type !== 'number' ? dir : +dir;
}
});
return values;
});
//# sourceMappingURL=createValues.js.map