Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-line-parse

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-line-parse

Parse a propery delimited file, line-by-line, and return a Javascript array with object representations

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

file-line-parse Travis XO code style

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 stripes
const fileLineParse = require('file-line-parse');
const input = './data/CATS_DATA.csv';
const keys = [ 'name', 'breed', 'age', 'color'];
fileLineParse(input, keys)
.then(cats => {
    console.log(cats[0])
    // { name: 'Bubbles', breed: 'Persian', age: '24', color: 'honey-brown' }

    console.log(cats[1])
    // { name: 'Garfield', breed: 'Tabby', age: '33', color: 'orange with stripes' }
});

API

fileLineParse(input, keys, [options])

Return a set of parsed objects dictacted by sequence of keys

input | <string>

Path to file to be input.

keys | <array>[<string> | <int>]

An array of keys to serve as mapping for object creation.

options | <object>
options.delimiter | <string>

Specify the delimiter to be used. Default: ","

:arrows_counterclockwise: objects-to-file - Create a delimited value, output file from an array of objects.

License

MIT

Keywords

FAQs

Package last updated on 25 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc