2.0.1 • Published 5 years ago

types-from-csv v2.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Types From CSV

Overview

types-from-csv is a package I wrote to help me infer SQL types given a CSV file. It's very rudimentary. It takes in the path to a CSV and returns a list of objects of the form:

[
    {name: 'columnOneName', type: 'bit'},
    {name: 'columnTwoName', type: 'date'},
    {name: 'columnThreeName', type: 'char'},
    {name: 'columnFourName', type: 'number'},
    {name: 'columnFiveName', type: 'string'}
]

Currently, it only detects those types. 'string' is the fallback if nothing else matches.

Usage

const csvTypes = require('csv-types');

const typeData = csvTypes.getTypesFromCSV('yourpath.csv');
console.log(typeData);
2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago