@charlietango/react-docs-net
Advanced tools
Comparing version
@@ -27,2 +27,13 @@ // | ||
function getGenerics(name ) { | ||
const match = name.match(/<(.+)>/); | ||
if (match) { | ||
return match[1].split(',').map(type => { | ||
if (type.endsWith('Types')) return typesName(type); | ||
return modelName(type); | ||
}); | ||
} | ||
return undefined; | ||
} | ||
function cleanName(name ) { | ||
@@ -34,4 +45,7 @@ const clean = name.replace('ViewModel', '').replace(/(Model|Types)$/, ''); | ||
function modelName(name ) { | ||
if (name.endsWith('Types')) return typesName(name); | ||
return cleanName(name) + 'ViewModel'; | ||
const generics = getGenerics(name); | ||
const append = generics ? `<${generics.join(', ')}>` : ''; | ||
if (name.endsWith('Types')) return typesName(name) + append; | ||
return cleanName(name) + 'ViewModel' + append; | ||
} | ||
@@ -38,0 +52,0 @@ |
@@ -111,3 +111,5 @@ // | ||
${comment(model.description, 4)} | ||
public ${flags.isStatic ? 'static' : 'partial'} class ${modelName(name)} | ||
public ${flags.isStatic ? 'static' : 'partial'} class ${modelName( | ||
model.displayName || name | ||
)} | ||
{ | ||
@@ -114,0 +116,0 @@ ${propsResult.output} |
{ | ||
"name": "@charlietango/react-docs-net", | ||
"description": "Package and publish a NuGet package to a custom feed.", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"main": "lib/index.js", | ||
@@ -43,3 +43,3 @@ "bin": { | ||
}, | ||
"gitHead": "7ca6453f1040e5d00872382d441f575ade18a441" | ||
"gitHead": "db216ed70a80686b76a61524b88b064b8bd84770" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51096
1.61%863
1.65%