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

parse-columns

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-columns - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

39

index.js

@@ -67,23 +67,32 @@ 'use strict';

var transform = opts.transform;
var els;
for (var i = 0, els; i < lines.length; i++) {
els = splitAt(lines[i], splits, {remove: true});
if (!headers) {
headers = [];
els = splitAt(lines[0], splits, {remove: true});
if (i !== 0) {
var row = {};
for (var j = 0, el, header; j < headers.length; j++) {
el = (els[j] || '').trim();
header = headers[j];
row[header] = transform ? transform(el, header, j, i) : el;
for (var index = 0, el; index < els.length; ++index) {
el = els[index].trim();
if (el) {
headers.push(el);
} else {
splits[index - 1] = null;
}
}
rows.push(row);
} else if (!headers) {
headers = [];
splits = splits.filter(Boolean);
}
for (var j2 = 0; j2 < els.length; j2++) {
headers.push(els[j2].trim());
}
for (var i = 1; i < lines.length; i++) {
els = splitAt(lines[i], splits, {remove: true});
var row = {};
for (var j = 0, el, header; j < headers.length; j++) {
el = (els[j] || '').trim();
header = headers[j];
row[header] = transform ? transform(el, header, j, i) : el;
}
rows.push(row);
}

@@ -90,0 +99,0 @@

{
"name": "parse-columns",
"version": "1.2.0",
"version": "1.3.0",
"description": "Parse text columns, like the output of unix commands",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "node test.js"
"test": "ava"
},

@@ -49,4 +49,4 @@ "files": [

"devDependencies": {
"ava": "^0.2.0"
"ava": "*"
}
}
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