UNPKG

1.45 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var camelcase = require("camelcase");
4var Utility = /** @class */ (function () {
5 function Utility() {
6 }
7 Utility.translateType = function (csType, options) {
8 if (['string', 'String', 'Guid'].indexOf(csType) !== -1) {
9 return 'string';
10 }
11 else if (['bool', 'Boolean'].indexOf(csType) !== -1) {
12 return 'boolean';
13 }
14 else if (['dynamic', 'JObject'].indexOf(csType) !== -1) {
15 return 'any';
16 }
17 else if (['byte', 'short', 'int', 'long', 'float', 'double', 'decimal'].indexOf(csType) !== -1) {
18 return 'number';
19 }
20 else if (['Byte', 'Int16', 'Int32', 'Int64', 'Single', 'Double', 'Decimal'].indexOf(csType) !== -1) {
21 return 'number';
22 }
23 else if (csType === 'DateTime') {
24 return options.dateTimeToDate ? 'Date' : 'string';
25 }
26 else if (options.tsTypeMap[csType]) {
27 return options.tsTypeMap[csType];
28 }
29 return undefined;
30 };
31 Utility.transfromPropertyName = function (propertyName) {
32 var tsPropertyName = camelcase(propertyName);
33 if (propertyName.startsWith('_')) {
34 tsPropertyName = "_" + tsPropertyName;
35 }
36 return tsPropertyName;
37 };
38 return Utility;
39}());
40exports.Utility = Utility;
41//# sourceMappingURL=utility.js.map
\No newline at end of file