source: node_modules/d3-fetch/src/dsv.js@ a762898

Last change on this file since a762898 was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 710 bytes
Line 
1import {csvParse, dsvFormat, tsvParse} from "d3-dsv";
2import text from "./text.js";
3
4function dsvParse(parse) {
5 return function(input, init, row) {
6 if (arguments.length === 2 && typeof init === "function") row = init, init = undefined;
7 return text(input, init).then(function(response) {
8 return parse(response, row);
9 });
10 };
11}
12
13export default function dsv(delimiter, input, init, row) {
14 if (arguments.length === 3 && typeof init === "function") row = init, init = undefined;
15 var format = dsvFormat(delimiter);
16 return text(input, init).then(function(response) {
17 return format.parse(response, row);
18 });
19}
20
21export var csv = dsvParse(csvParse);
22export var tsv = dsvParse(tsvParse);
Note: See TracBrowser for help on using the repository browser.