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

d3-dsv

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-dsv - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

build/dsv.cjs.js

10

build/dsv.js

@@ -7,3 +7,3 @@ (function (global, factory) {

var dsv = function(delimiter) {
function dsv(delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n]"),

@@ -122,9 +122,11 @@ delimiterCode = delimiter.charCodeAt(0);

};
}
};
exports.csv = dsv(",");
exports.tsv = dsv("\t");
var csv = dsv(",");
var tsv = dsv("\t");
exports.csv = csv;
exports.tsv = tsv;
exports.dsv = dsv;
}));

2

build/dsv.min.js

@@ -1,1 +0,1 @@

!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r.dsv={})}(this,function(r){"use strict";var n=function(r){function n(r,n){var t;return e(r,function(r,e){if(t)return t(r,e-1);var o=new Function("d","return {"+r.map(function(r,n){return JSON.stringify(r)+": d["+n+"]"}).join(",")+"}");t=n?function(r,e){return n(o(r),e)}:o})}function e(r,n){function e(){if(s>=a)return u;if(o)return o=!1,i;var n=s;if(34===r.charCodeAt(n)){for(var e=n;e++<a;)if(34===r.charCodeAt(e)){if(34!==r.charCodeAt(e+1))break;++e}s=e+2;var t=r.charCodeAt(e+1);return 13===t?(o=!0,10===r.charCodeAt(e+2)&&++s):10===t&&(o=!0),r.slice(n+1,e).replace(/""/g,'"')}for(;a>s;){var t=r.charCodeAt(s++),f=1;if(10===t)o=!0;else if(13===t)o=!0,10===r.charCodeAt(s)&&(++s,++f);else if(t!==c)continue;return r.slice(n,s-f)}return r.slice(n)}for(var t,o,i={},u={},f=[],a=r.length,s=0,p=0;(t=e())!==u;){for(var d=[];t!==i&&t!==u;)d.push(t),t=e();n&&null==(d=n(d,p++))||f.push(d)}return f}function t(n){if(Array.isArray(n[0]))return o(n);var e=Object.create(null),t=[];return n.forEach(function(r){for(var n in r)(n+="")in e||t.push(e[n]=n)}),[t.map(u).join(r)].concat(n.map(function(n){return t.map(function(r){return u(n[r])}).join(r)})).join("\n")}function o(r){return r.map(i).join("\n")}function i(n){return n.map(u).join(r)}function u(r){return f.test(r)?'"'+r.replace(/\"/g,'""')+'"':r}var f=new RegExp('["'+r+"\n]"),c=r.charCodeAt(0);return{parse:n,parseRows:e,format:t,formatRows:o}};r.csv=n(","),r.tsv=n(" "),r.dsv=n});
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(r.dsv={})}(this,function(r){"use strict";function n(r){function n(r,n){var t;return e(r,function(r,e){if(t)return t(r,e-1);var o=new Function("d","return {"+r.map(function(r,n){return JSON.stringify(r)+": d["+n+"]"}).join(",")+"}");t=n?function(r,e){return n(o(r),e)}:o})}function e(r,n){function e(){if(s>=a)return u;if(o)return o=!1,i;var n=s;if(34===r.charCodeAt(n)){for(var e=n;e++<a;)if(34===r.charCodeAt(e)){if(34!==r.charCodeAt(e+1))break;++e}s=e+2;var t=r.charCodeAt(e+1);return 13===t?(o=!0,10===r.charCodeAt(e+2)&&++s):10===t&&(o=!0),r.slice(n+1,e).replace(/""/g,'"')}for(;a>s;){var t=r.charCodeAt(s++),f=1;if(10===t)o=!0;else if(13===t)o=!0,10===r.charCodeAt(s)&&(++s,++f);else if(t!==c)continue;return r.slice(n,s-f)}return r.slice(n)}for(var t,o,i={},u={},f=[],a=r.length,s=0,p=0;(t=e())!==u;){for(var d=[];t!==i&&t!==u;)d.push(t),t=e();n&&null==(d=n(d,p++))||f.push(d)}return f}function t(n){if(Array.isArray(n[0]))return o(n);var e=Object.create(null),t=[];return n.forEach(function(r){for(var n in r)(n+="")in e||t.push(e[n]=n)}),[t.map(u).join(r)].concat(n.map(function(n){return t.map(function(r){return u(n[r])}).join(r)})).join("\n")}function o(r){return r.map(i).join("\n")}function i(n){return n.map(u).join(r)}function u(r){return f.test(r)?'"'+r.replace(/\"/g,'""')+'"':r}var f=new RegExp('["'+r+"\n]"),c=r.charCodeAt(0);return{parse:n,parseRows:e,format:t,formatRows:o}}var e=n(","),t=n(" ");r.csv=e,r.tsv=t,r.dsv=n});
{
"name": "d3-dsv",
"version": "0.1.5",
"version": "0.1.6",
"description": "A parser and formatter for delimiter-separated values, such as CSV and TSV",

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

},
"main": "build/dsv",
"main": "build/dsv.cjs",
"jsnext:main": "index.js",

@@ -31,12 +31,12 @@ "bin": {

"scripts": {
"pretest": "mkdir -p build && d3-bundler --format=umd --name=dsv -- index.js > build/dsv.js",
"pretest": "mkdir -p build && d3-bundler -x -f cjs -o build/dsv.cjs.js",
"test": "faucet `find test -name '*-test.js'`",
"prepublish": "npm run test && uglifyjs build/dsv.js -c -m -o build/dsv.min.js && rm -f build/dsv.zip && zip -j build/dsv.zip -- LICENSE README.md build/dsv.js build/dsv.min.js"
"prepublish": "npm run test && d3-bundler -n dsv -o build/dsv.js && uglifyjs build/dsv.js -c -m -o build/dsv.min.js && rm -f build/dsv.zip && zip -j build/dsv.zip -- LICENSE README.md build/dsv.js build/dsv.min.js"
},
"devDependencies": {
"d3-bundler": "~0.2.5",
"d3-bundler": "~0.4.0",
"faucet": "0.0",
"tape": "4",
"uglifyjs": "2"
"uglify-js": "2"
}
}

@@ -13,2 +13,8 @@ # d3-dsv

## Installing
If you use NPM, `npm install d3-dsv`. Otherwise, download the [latest release](https://github.com/d3/d3-dsv/releases/latest).
## API Reference
<a name="dsv" href="#dsv">#</a> <b>dsv</b>(<i>delimiter</i>)

@@ -118,1 +124,18 @@

If a [content security policy](http://www.w3.org/TR/CSP/) is in place, note that [*dsv*.parse](#dsv_parse) requires `unsafe-eval` in the `script-src` directive, due to the (safe) use of dynamic code generation for fast parsing. (See [source](https://github.com/d3/d3-dsv/blob/master/src/dsv.js).) Alternatively, use [*dsv*.parseRows](#dsv_parseRows).
## Command Line Reference
The d3-dsv module comes with a few binaries to convert DSV files:
* csv2json
* csv2tsv
* tsv2csv
* tsv2json
These programs either take a single file as an argument or read from stdin, and write to stdout. For example, these statements are all equivalent:
```
csv2json file.csv > file.json
csv2json < file.csv > file.json
cat file.csv | csv2json - > file.json
```
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