Socket
Socket
Sign inDemoInstall

chopped-and-viewed

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chopped-and-viewed

For chopping fixed-width text files into JSON or a CSV


Version published
Weekly downloads
2
Maintainers
1
Created
Weekly downloads
 

Readme

Source

chopped-and-viewed

A small node module for parsing fixed-width text.

Supply an array of column widths and get back an array of values.

Supply an optional second array of column names to get back a hash/dictionary instead.

Usage

Option 1: Array

var cav = require("chopped-and-viewed");

var parser = cav([3,3,3,4]);

console.log(parser("A  BCDEF GHIJ"));
//['A','BCD','EF','GHIJ']

console.log(parser("NPMIS THEBEST"));
//['NPM','IS','THE','BEST']

Option 2: Hash

var cav = require("chopped-and-viewed");

var parser = cav([5,3,5],["first","second","third"]);

console.log(parser("FOO  BARSTUFF"));
//{ 'first': 'FOO', 'second': 'BAR', 'third': 'STUFF' }

Keywords

FAQs

Last updated on 29 Dec 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc