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

csv-string

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-string - npm Package Compare versions

Comparing version 2.3.0 to 2.3.1

30

lib/csv.js

@@ -44,21 +44,17 @@ 'use strict';

exports.detect = function (input)
exports.detect = function detect (input)
{
var separators = [{c: 0, v: ','}, {c: 0, v: ';'}, {c: 0, v: '|'}, {c: 0, v: '\t'}, {c: 0, v: ':'}, {c: 0, v: null}];
separators.forEach(function (item, indice) {
item.c += input.split(item.v).length;
var separators = [',', ';', '|', '\t'];
var min = 99999999;
var idx = separators.map(function (separator, index) {
return input.indexOf(separator);
}).reduce(function (prev, cur, index) {
if (cur !== -1 && cur < min) {
return cur;
}
);
var max = 0;
var separator = separators.reduce(function (prev, cur) {
if (cur.c >= max) {
max = cur.c;
return cur.v;
}
else {
return prev;
}
}, null
);
return separator;
else {
return prev;
}
});
return input[idx] || ',';
}

@@ -65,0 +61,0 @@

{
"name": "csv-string",
"version": "2.3.0",
"version": "2.3.1",
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",

@@ -5,0 +5,0 @@ "contributors": [

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