From d7ee161569535bbac6ba3cb2af3dc59633f459e4 Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Tue, 20 Feb 2018 20:23:41 +0100 Subject: [PATCH] New typings for csv2json --- types/csv2json/csv2json-tests.ts | 8 ++++++++ types/csv2json/index.d.ts | 15 +++++++++++++++ types/csv2json/tsconfig.json | 23 +++++++++++++++++++++++ types/csv2json/tslint.json | 1 + 4 files changed, 47 insertions(+) create mode 100644 types/csv2json/csv2json-tests.ts create mode 100644 types/csv2json/index.d.ts create mode 100644 types/csv2json/tsconfig.json create mode 100644 types/csv2json/tslint.json diff --git a/types/csv2json/csv2json-tests.ts b/types/csv2json/csv2json-tests.ts new file mode 100644 index 0000000000..269d4c2dfe --- /dev/null +++ b/types/csv2json/csv2json-tests.ts @@ -0,0 +1,8 @@ +import csv2json from "csv2json"; +import fs from "fs"; + +fs.createReadStream('data.csv') + .pipe(csv2json({ + separator: ';' + })) + .pipe(fs.createWriteStream('data.json')); diff --git a/types/csv2json/index.d.ts b/types/csv2json/index.d.ts new file mode 100644 index 0000000000..f1c08c3e7c --- /dev/null +++ b/types/csv2json/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for csv2json 1.4 +// Project: https://github.com/julien-f/csv2json +// Definitions by: Piotr Roszatycki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Writable } from "stream"; + +export interface CSV2JSONOptions { + dynamicTyping?: boolean; + separator?: string; +} + +export default function csv2json (options: CSV2JSONOptions): Writable; diff --git a/types/csv2json/tsconfig.json b/types/csv2json/tsconfig.json new file mode 100644 index 0000000000..e9840faef7 --- /dev/null +++ b/types/csv2json/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "csv2json-tests.ts" + ] +} diff --git a/types/csv2json/tslint.json b/types/csv2json/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/csv2json/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }