type-genius
Advanced tools
Comparing version 0.0.4 to 0.0.6
@@ -56,2 +56,6 @@ export interface ValueTypeConfiguration { | ||
/** | ||
* Return the string that would get rendered to a file. Enabling this prevents the file from being written. | ||
*/ | ||
returnFileString?: boolean; | ||
/** | ||
* Whether to write the file or not. | ||
@@ -58,0 +62,0 @@ */ |
@@ -209,2 +209,5 @@ "use strict"; | ||
var fileString = typesStore.map(function (t) { return t.string; }).join("\n\n") + "\n"; | ||
if (options === null || options === void 0 ? void 0 : options.returnFileString) { | ||
return fileString; | ||
} | ||
// Write the file using that string | ||
@@ -211,0 +214,0 @@ var outputPath = (options === null || options === void 0 ? void 0 : options.outputPath) || "../dist/"; |
{ | ||
"name": "type-genius", | ||
"version": "0.0.4", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -41,2 +41,3 @@ # Type Genius | ||
| renderSemis | Boolean? | false | Render semicolons in the outputted file. | | ||
| returnFileString | Boolean? | false | Return the string that would get rendered to a file. Enabling this prevents the file from being written. | | ||
| skipFileWrite | Boolean? | false | Whether to write the file or not. | | ||
@@ -43,0 +44,0 @@ | useStore | TypeStore? | [] | Store of existing InterfaceConfiguration objects to use for this generation. | |
@@ -61,2 +61,6 @@ export interface ValueTypeConfiguration { | ||
/** | ||
* Return the string that would get rendered to a file. Enabling this prevents the file from being written. | ||
*/ | ||
returnFileString?: boolean; | ||
/** | ||
* Whether to write the file or not. | ||
@@ -63,0 +67,0 @@ */ |
@@ -28,3 +28,3 @@ import { writeFile } from "fs"; | ||
function getTypeConfig( | ||
value: any, | ||
value: unknown, | ||
options: BuildOptions | ||
@@ -100,3 +100,3 @@ ): ValueTypeConfiguration { | ||
typeConfig.object_keys = generateTypeConfigFromObject( | ||
value, | ||
value as { [key: string]: unknown }, | ||
options | ||
@@ -117,3 +117,3 @@ ); | ||
function generateTypeConfigFromObject( | ||
obj: { [key: string]: any }, | ||
obj: { [key: string]: unknown }, | ||
options: BuildOptions | ||
@@ -252,3 +252,3 @@ ) { | ||
export function buildTypes( | ||
data: { [key: string]: any }, | ||
data: { [key: string]: unknown }, | ||
options?: BuildOptions | ||
@@ -273,2 +273,6 @@ ) { | ||
if (options?.returnFileString) { | ||
return fileString; | ||
} | ||
// Write the file using that string | ||
@@ -275,0 +279,0 @@ const outputPath = options?.outputPath || "../dist/"; |
30447
721
159