vstack-typescript-generator
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -28,3 +28,3 @@ 'use strict'; | ||
var result = results.join('\n\n'); | ||
if (result && options && options.baseNamespace) { | ||
if (result && options && options.moduleName) { | ||
var indentedResult = result | ||
@@ -34,3 +34,3 @@ .split('\n') | ||
.join('\n'); | ||
result = "module " + options.baseNamespace + " {\n" + indentedResult + "\n}"; | ||
result = "module " + options.moduleName + " {\n" + indentedResult + "\n}"; | ||
} | ||
@@ -43,3 +43,2 @@ return result; | ||
'use strict'; | ||
var modifier = options && options.baseNamespace ? 'export' : 'declare'; | ||
var nextIndex = 0; | ||
@@ -52,3 +51,3 @@ var entryStrings = []; | ||
} | ||
return modifier + " enum " + cSharpEnum.name + " {\n " + entryStrings.join(',\n ') + "\n}"; | ||
return "export enum " + cSharpEnum.name + " {\n " + entryStrings.join(',\n ') + "\n}"; | ||
} | ||
@@ -59,3 +58,2 @@ function generateInterface(type, options) { | ||
var ignoreInhertitance = options && options.ignoreInheritance && options.ignoreInheritance.indexOf(type.inherits) !== -1; | ||
var modifier = options && options.baseNamespace ? 'export ' : ''; | ||
var tsInterfaceName = prefixWithI ? "I" + type.name : type.name; | ||
@@ -76,10 +74,9 @@ var tsExtends = type.inherits && !ignoreInhertitance ? " extends " + type.inherits : ''; | ||
} | ||
return modifier + "interface " + tsInterfaceName + tsExtends + " {\n " + propertyStrings.join(';\n ') + ";\n}"; | ||
return "export interface " + tsInterfaceName + tsExtends + " {\n " + propertyStrings.join(';\n ') + ";\n}"; | ||
} | ||
function generatePrimaryFilter(type, options) { | ||
'use strict'; | ||
var modifier = options && options.baseNamespace ? 'export ' : ''; | ||
var domainType = type.inherits.match(primaryDtoFilterRegex)[1]; | ||
var filterGroup = pluralize(domainType); | ||
var filterType = options && options.dtoNamespace ? options.dtoNamespace + "." + domainType : domainType; | ||
var filterType = options && options.dtoModuleName ? options.dtoModuleName + "." + domainType : domainType; | ||
var tsConstructorParameters = []; | ||
@@ -123,3 +120,3 @@ var filterParameters = []; | ||
var result = ''; | ||
result += modifier + "class " + filterGroup + type.name + "Filter implements IPrimaryFilter<" + filterType + "> {\n"; | ||
result += "export class " + filterGroup + type.name + "Filter implements IPrimaryFilter<" + filterType + "> {\n"; | ||
result += " constructor(" + tsConstructorParameters.join(', ') + ") {\n"; | ||
@@ -126,0 +123,0 @@ result += " }\n\n"; |
export interface Options { | ||
baseNamespace?: string; | ||
moduleName?: string; | ||
prefixWithI?: boolean; | ||
@@ -7,3 +7,3 @@ dateTimeToDate?: boolean; | ||
propertyNameResolver?: (prop: string) => string; | ||
dtoNamespace?: string; | ||
dtoModuleName?: string; | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
} | ||
else if (['int', 'short', 'decimal', 'double', 'float', 'Int32', 'Int64'].indexOf(csType) !== -1) { | ||
else if (['int', 'short', 'decimal', 'double', 'float', 'byte', 'Int32', 'Int64', 'Byte'].indexOf(csType) !== -1) { | ||
return 'number'; | ||
@@ -18,0 +18,0 @@ } |
{ | ||
"name": "vstack-typescript-generator", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
34646
421