Parse a property delimited file, line-by-line, and return the line in a JavaScript array in object representation.
fileLineParse(📄) => [ {}, {}, {} ]
Install
$ npm install --save file-line-parse
OR $ yarn add file-line-parse
Usage
// CATS_DATA.csv:// Bubbles,Persian,24,honey-brown// Garfield,Tabby,33,orange with stripesconst fileLineParse = ;const input = './data/CATS_DATA.csv';const keys = 'name' 'breed' 'age' 'color';;
API
fileLineParse(input, keys, [options])
Return a set
of parsed objects dictacted by sequence of keys
<string>
input | Path to file to be input.
<array>[<string> | <int>]
keys | An array of keys to serve as mapping for object creation.
<object>
options | <string>
options.delimiter | Specify the delimiter to be used. Default: ","
Related
🔄 objects-to-file - Create a delimited value, output file from an array of objects.
License
MIT