diff --git a/yaml-to-go.ts b/yaml-to-go.ts index 67dd25a..6912d59 100644 --- a/yaml-to-go.ts +++ b/yaml-to-go.ts @@ -233,8 +233,14 @@ export function yamlToGo(input: string, typename = "AutoGenerated", flatten = tr switch (typeof val) { case "string": + let newSlice = val.slice(2,), + newlen = newSlice.length/2, + strSlice = newlen.toString(); + if (/\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(\+\d\d:\d\d|Z)/.test(val)) return "time.Time"; + else if (val.startsWith('0x')) + return "["+strSlice+"]byte"; else return "string"; case "number": if (val % 1 === 0) {