New typings for csv2json

This commit is contained in:
Piotr Roszatycki
2018-02-20 20:23:41 +01:00
parent 070eb128b8
commit d7ee161569
4 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import csv2json from "csv2json";
import fs from "fs";
fs.createReadStream('data.csv')
.pipe(csv2json({
separator: ';'
}))
.pipe(fs.createWriteStream('data.json'));

15
types/csv2json/index.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
// Type definitions for csv2json 1.4
// Project: https://github.com/julien-f/csv2json
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Writable } from "stream";
export interface CSV2JSONOptions {
dynamicTyping?: boolean;
separator?: string;
}
export default function csv2json (options: CSV2JSONOptions): Writable;

View File

@@ -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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }