修复特殊key的bug

This commit is contained in:
kangkang520
2018-11-13 00:09:39 +08:00
parent 2f8a2ac9a8
commit 6e8354128d
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ini-decode", "name": "ini-decode",
"version": "1.0.6", "version": "1.0.7",
"description": "", "description": "",
"main": "dist/index.js", "main": "dist/index.js",
"types": "typing/index.d.ts", "types": "typing/index.d.ts",

View File

@ -74,6 +74,7 @@ function parseDetail(data: any, parent: any, key: any): string {
} }
else { else {
return `{\n\t${Object.keys(data).map(key => { return `{\n\t${Object.keys(data).map(key => {
key = (/\-/.test(key)) ? `'${key}'` : key
return `${key}: ${parseDetail(data[key], data, key).replace(/\n/g, '\n\t')}` return `${key}: ${parseDetail(data[key], data, key).replace(/\n/g, '\n\t')}`
}).join('\n\t')}\n}` }).join('\n\t')}\n}`
} }