From 2f8a2ac9a8a0c8e821f3235211bd4fccc279715a Mon Sep 17 00:00:00 2001 From: kangkang520 Date: Tue, 13 Nov 2018 00:03:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=90=8D=E7=A7=B0=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/index.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 09207cb..db3d2c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ini-decode", - "version": "1.0.5", + "version": "1.0.6", "description": "", "main": "dist/index.js", "types": "typing/index.d.ts", diff --git a/src/index.ts b/src/index.ts index e53debe..80e0754 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,12 +82,13 @@ function parseDetail(data: any, parent: any, key: any): string { /** * 解码ini文件 * @param content 数据内容 + * @param interfaceName 自定义接口名称 */ -export function decode(content: string | Buffer) { +export function decode(content: string | Buffer, interfaceName?: string) { const base = parseBase(content) const dts = parseDetail(base, null, null) return { json: base, - dts: dts, + dts: `interface ${interfaceName||'ini'} ${dts}`, } } \ No newline at end of file