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

sv

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sv - npm Package Compare versions

Comparing version 0.3.9 to 0.3.10

48

common.js

@@ -27,50 +27,2 @@ /**

exports.zip = zip;
function inferColumns(rows) {
var columns = [];
var seen = {};
rows.forEach(function (row) {
// each object might be a string, array, or object, but only objects matter here.
if (typeof (row) !== 'string' && !Array.isArray(row)) {
Object.keys(row).forEach(function (key) {
// if (row.hasOwnProperty(key)) {
// maybe should also check that row[key] != null
if (!(key in seen)) {
columns.push(key);
seen[key] = 1;
}
// }
});
}
});
return columns;
}
exports.inferColumns = inferColumns;
/**
returns a single char code (a byte) denoting the inferred delimiter.
*/
function inferDelimiter(buffer) {
var counts = {};
// we look at the first newline or 256 chars, whichever is greater,
// but without going through the whole file
var upto = Math.min(256, buffer.length);
for (var i = 0; i < upto && buffer[i] != 10 && buffer[i] != 13; i++) {
var char_code = buffer[i];
counts[char_code] = (counts[char_code] || 0) + 1;
}
// we'll go through, prioritizing characters that aren't likely to show
// up unless they are a delimiter.
var candidates = [
9,
59,
44,
32,
];
// TODO: make this more robust (that's why I even counted them)
for (var candidate, j = 0; (candidate = candidates[j]); j++) {
if (counts[candidate] > 0) {
return candidate;
}
}
}
exports.inferDelimiter = inferDelimiter;
function commonPrefix(filepaths) {

@@ -77,0 +29,0 @@ var prefix = filepaths[0];

4

package.json
{
"name": "sv",
"version": "0.3.9",
"version": "0.3.10",
"description": "Any separated values.",

@@ -30,3 +30,3 @@ "keywords": [

"mocha": "*",
"typescript": "next"
"typescript": "*"
},

@@ -33,0 +33,0 @@ "scripts": {

@@ -17,2 +17,30 @@ var __extends = (this && this.__extends) || function (d, b) {

/**
returns a single char code (a byte) denoting the inferred delimiter.
*/
function inferDelimiter(buffer) {
var counts = {};
// we look at the first newline or 256 chars, whichever is greater,
// but without going through the whole file
var upto = Math.min(256, buffer.length);
for (var i = 0; i < upto && buffer[i] != 10 && buffer[i] != 13; i++) {
var char_code = buffer[i];
counts[char_code] = (counts[char_code] || 0) + 1;
}
// we'll go through, prioritizing characters that aren't likely to show
// up unless they are a delimiter.
var candidates = [
9,
59,
44,
32,
];
// TODO: make this more robust (that's why I even counted them)
for (var candidate, j = 0; (candidate = candidates[j]); j++) {
if (counts[candidate] > 0) {
return candidate;
}
}
}
exports.inferDelimiter = inferDelimiter;
/**
- `byteBuffer` is a buffer (of bytes) that have yet to be processed (and sent to output).

@@ -67,3 +95,3 @@ - `cellBuffer` is a list of strings that have yet to be processed (and sent to output).

// should we wait for some minimum amount of data?
this.delimiterByte = common_1.inferDelimiter(buffer);
this.delimiterByte = inferDelimiter(buffer);
}

@@ -70,0 +98,0 @@ var start = 0;

@@ -17,2 +17,22 @@ var __extends = (this && this.__extends) || function (d, b) {

};
function inferColumns(rows) {
var columns = [];
var seen = {};
rows.forEach(function (row) {
// each object might be a string, array, or object, but only objects matter here.
if (typeof (row) !== 'string' && !Array.isArray(row)) {
Object.keys(row).forEach(function (key) {
// if (row.hasOwnProperty(key)) {
// maybe should also check that row[key] != null
if (!(key in seen)) {
columns.push(key);
seen[key] = 1;
}
// }
});
}
});
return columns;
}
exports.inferColumns = inferColumns;
/** Stringifier class

@@ -103,3 +123,3 @@ new Stringifier();

// infer columns
this.config.columns = common_1.inferColumns(this.rowBuffer);
this.config.columns = inferColumns(this.rowBuffer);
this.writeObject(this.config.columns);

@@ -106,0 +126,0 @@ }

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