UNPKG

swagger-typescript-generator

Version:

Generate typescript code from swagger.json. Before start this project I try use [swagger-typescript-codegen](https://github.com/mtennoe/swagger-typescript-codegen) based on [mustache templates](https://github.com/mtennoe/swagger-js-codegen/tree/master/lib

32 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.uniqueItems = exports.nameof = exports.privateSymbol = exports.html2text = exports.lowerlize = exports.capitalize = void 0; exports.capitalize = function (s) { if (typeof s !== 'string') return ''; return s.charAt(0).toUpperCase() + s.slice(1); }; exports.lowerlize = function (s) { if (typeof s !== 'string') return ''; return s.charAt(0).toLowerCase() + s.slice(1); }; exports.html2text = function (html) { return html.replace(/<(?:.|\n)*?>/gm, '') .replace(/&lt;/gm, '<') .replace(/&gt;/gm, '>') .replace(/&#x27;/gm, '\''); }; exports.privateSymbol = Symbol('private'); exports.nameof = function (name) { return name; }; exports.uniqueItems = function (items, keyFn) { var uniqueEnums = items.reduce(function (it, el) { var key = keyFn(el); if (key) { it[key] = el; } return it; }, {}); return Object.values(uniqueEnums); }; //# sourceMappingURL=utils.js.map