Socket
Socket
Sign inDemoInstall

json-2-csv

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-2-csv - npm Package Compare versions

Comparing version 2.0.19 to 2.0.20

36

lib/converter.js

@@ -14,2 +14,13 @@ 'use strict';

var isDefined = function (val) {
return !_.isUndefined(val);
};
var copyOption = function (options, lowercasePath, uppercasePath) {
var lowerCaseValue = docPath.evaluatePath(options, lowercasePath);
if (isDefined(lowerCaseValue)) {
docPath.setPath(options, uppercasePath, lowerCaseValue);
}
};
/**

@@ -27,15 +38,14 @@ * Build the options to be passed to the appropriate function

if (opts) {
if (!_.isUndefined(opts.prependHeader)) { docPath.setPath(opts, 'PREPEND_HEADER', opts.prependHeader); }
if (!_.isUndefined(opts.trimHeaderFields)) { docPath.setPath(opts, 'TRIM_HEADER_FIELDS', opts.trimHeaderFields); }
if (!_.isUndefined(opts.trimFieldValues)) { docPath.setPath(opts, 'TRIM_FIELD_VALUES', opts.trimFieldValues); }
if (!_.isUndefined(opts.sortHeader)) { docPath.setPath(opts, 'SORT_HEADER', opts.sortHeader); }
if (!_.isUndefined(opts.parseCsvNumbers)) { docPath.setPath(opts, 'PARSE_CSV_NUMBERS', opts.parseCsvNumbers); }
if (!_.isUndefined(opts.keys)) { docPath.setPath(opts, 'KEYS', opts.keys); }
if (!_.isUndefined(opts.checkSchemaDifferences)) { docPath.setPath(opts, 'CHECK_SCHEMA_DIFFERENCES', opts.checkSchemaDifferences); }
if (!_.isUndefined(opts.emptyFieldValue)) { docPath.setPath(opts, 'EMPTY_FIELD_VALUE', opts.emptyFieldValue); }
if (!_.isUndefined(opts.delimiter)) {
if (!_.isUndefined(opts.delimiter.field)) { docPath.setPath(opts, 'DELIMITER.FIELD', opts.delimiter.field); }
if (!_.isUndefined(opts.delimiter.array)) { docPath.setPath(opts, 'DELIMITER.ARRAY', opts.delimiter.array); }
if (!_.isUndefined(opts.delimiter.wrap)) { docPath.setPath(opts, 'DELIMITER.WRAP', opts.delimiter.wrap); }
if (!_.isUndefined(opts.delimiter.eol)) { docPath.setPath(opts, 'DELIMITER.EOL', opts.delimiter.eol); }
copyOption(opts, 'prependHeader', 'PREPEND_HEADER');
copyOption(opts, 'trimHeaderFields', 'TRIM_HEADER_FIELDS');
copyOption(opts, 'sortHeader', 'SORT_HEADER');
copyOption(opts, 'parseCsvNumbers', 'PARSE_CSV_NUMBERS');
copyOption(opts, 'keys', 'KEYS');
copyOption(opts, 'checkSchemaDifferences', 'CHECK_SCHEMA_DIFFERENCES');
copyOption(opts, 'emptyFieldValue', 'EMPTY_FIELD_VALUE');
if (isDefined(opts.delimiter)) {
copyOption(opts, 'delimiter.field', 'DELIMITER.FIELD');
copyOption(opts, 'delimiter.array', 'DELIMITER.ARRAY');
copyOption(opts, 'delimiterwrap', 'DELIMITER.WRAP');
copyOption(opts, 'delimiter.eol', 'DELIMITER.EOL');
}

@@ -42,0 +52,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
"version": "2.0.19",
"version": "2.0.20",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

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