How to use the d3-dsv.tsvFormat function in d3-dsv

To help you get started, we’ve selected a few d3-dsv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / d3-dsv / d3-dsv-tests.ts View on Github external
model: rr[2],
        length: +rr[3]
    };

    return pr;

});

date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;

// tsvFormat(...) ============================================================================

str = d3Dsv.tsvFormat(parseRowsMappedArray);
str = d3Dsv.tsvFormat(parseRowsMappedArray, columns);

// tsvFormatRows(...) ========================================================================

str = d3Dsv.tsvFormatRows(parseRowsMappedArray.map((d, i) => [
    d.year.getFullYear().toString(),
    d.make,
    d.model,
    d.length.toString()
]));

// ------------------------------------------------------------------------------------------
// Test DSV Generalized Parsers and Formatters
// ------------------------------------------------------------------------------------------

// Create custom-delimited Parser/Formatter =================================================
github DefinitelyTyped / DefinitelyTyped / d3-dsv / d3-dsv-tests.ts View on Github external
length: +rr[3]
    };

    return pr;

});

date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;

// tsvFormat(...) ============================================================================

str = d3Dsv.tsvFormat(parseRowsMappedArray);
str = d3Dsv.tsvFormat(parseRowsMappedArray, columns);

// tsvFormatRows(...) ========================================================================

str = d3Dsv.tsvFormatRows(parseRowsMappedArray.map((d, i) => [
    d.year.getFullYear().toString(),
    d.make,
    d.model,
    d.length.toString()
]));

// ------------------------------------------------------------------------------------------
// Test DSV Generalized Parsers and Formatters
// ------------------------------------------------------------------------------------------

// Create custom-delimited Parser/Formatter =================================================
github palerdot / exceljson / js / app.js View on Github external
var is_array = _.isArray( this.getJSON() );
                    
                    if (!is_array) {
                        Materialize.toast("JSON not an array!. Cannot convert JSON to TSV", 5000);
                        // do not proceed
                        return;
                    }
                    // now we need to find which module to use for the conversion
                    var parsed = "",
                        parse_error = false,
                        parse_error_msg = "";

                    if (this.isColumnHeader) {
                        try {
                            parsed = tsvFormat( this.getJSON() );
                            parse_error = false;    
                        } catch (e) {
                            parse_error = true;
                            parse_error_msg = "TSV conversion Failed. Please check if JSON is array of objects.";
                        }
                    } else {
                        try {
                            parsed = tsvFormatRows( this.getJSON() );    
                            parse_error = false;    
                        } catch (e) {
                            parse_error = true;
                            parse_error_msg = "TSV conversion Failed. Please check if JSON is array of arrays.";
                        }
                    }

                    if (parse_error) {
github mhkeller / indian-ocean / lib / index.js View on Github external
tsv: function (file, writeOptions) {
    writeOptions = writeOptions || {}
    file = formattingPreflight(file, 'tsv')
    try {
      return dsv.tsvFormat(file, writeOptions.columns)
    } catch (err) {
      reporters.parseError('tsv')
    }
  },
  psv: function (file, writeOptions) {
github mhkeller / joiner / bin / io / formatters.js View on Github external
tsv: function (file, writeOptions) {
    writeOptions = writeOptions || {}
    try {
      return dsv.tsvFormat(file, writeOptions.columns)
    } catch (err) {
      reportParseError('tsv')
    }
  },
  psv: function (file, writeOptions) {