openapi-ts-mock-generator
Version:
typescript mock data generator based openapi
86 lines • 2.93 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = function(target, all) {
for(var name in all)__defProp(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps = function(to, from, except, desc) {
if (from && typeof from === "object" || typeof from === "function") {
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
try {
var _loop = function() {
var key = _step.value;
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: function() {
return from[key];
},
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
};
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally{
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally{
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
return to;
};
var __toCommonJS = function(mod) {
return __copyProps(__defProp({}, "__esModule", {
value: true
}), mod);
};
// src/utils/string-utils.ts
var string_utils_exports = {};
__export(string_utils_exports, {
camelToKebab: function() {
return camelToKebab;
},
getFileExtension: function() {
return getFileExtension;
},
isUrl: function() {
return isUrl;
},
uuidToB64: function() {
return uuidToB64;
}
});
module.exports = __toCommonJS(string_utils_exports);
var uuidToB64 = function(uuid) {
var uuidBuffer = Buffer.from(uuid.replace(/-/g, ""), "hex");
var base64Uuid = uuidBuffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
return base64Uuid;
};
var camelToKebab = function(str) {
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
};
var isUrl = function(str) {
return str.startsWith("http://") || str.startsWith("https://");
};
var getFileExtension = function(filename) {
return filename.split(".").pop() || "";
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
camelToKebab: camelToKebab,
getFileExtension: getFileExtension,
isUrl: isUrl,
uuidToB64: uuidToB64
});
//# sourceMappingURL=string-utils.js.map