@@ -398,57 +398,53 @@ export function runTests() {
398398 const csv = json2csv ( jsonTestData . unwind , {
399399 unwindArrays : true ,
400400 keys : [
401- { field : 'data.category' } ,
401+ { field : 'data.category' } ,
402402 'data.options.name'
403403 ]
404404 } ) ;
405405 assert . equal ( csv , csvTestData . unwindWithSpecifiedKeys ) ;
406406 } ) ;
407407
408408 it ( 'should allow titles to be specified for certain keys, but not others when not unwinding arrays' , ( ) => {
409- console . log ( 'START EXEC----' ) ;
410409 const csv = json2csv ( jsonTestData . unwind , {
411410 unwindArrays : false ,
412411 keys : [
413- { field : 'data.category' , title : 'Category' } ,
412+ { field : 'data.category' , title : 'Category' } ,
414413 'data.options.name'
415414 ]
416415 } ) ;
417- console . log ( 'END EXEC----' ) ;
418416 assert . equal ( csv , csvTestData . withSpecifiedKeys . replace ( 'data.category,data.options.name' , 'Category,data.options.name' ) ) ;
419417 } ) ;
420418
421419 it ( 'should allow titles to be specified for certain keys, but not others' , ( ) => {
422420 const csv = json2csv ( jsonTestData . unwind , {
423421 unwindArrays : true ,
424422 keys : [
425- { field : 'data.category' , title : 'Category' } ,
423+ { field : 'data.category' , title : 'Category' } ,
426424 'data.options.name'
427425 ]
428426 } ) ;
429427 assert . equal ( csv , csvTestData . unwindWithSpecifiedKeys . replace ( 'data.category,data.options.name' , 'Category,data.options.name' ) ) ;
430428 } ) ;
431429
432430 it ( 'should allow titles to be specified' , ( ) => {
433- console . log ( 'START EXEC----' ) ;
434431
435432 const csv = json2csv ( jsonTestData . unwind , {
436433 unwindArrays : false ,
437434 keys : [
438- { field : 'data.category' , title : 'Category' } ,
439- { field : 'data.options.name' , title : 'Option Name' }
435+ { field : 'data.category' , title : 'Category' } ,
436+ { field : 'data.options.name' , title : 'Option Name' }
440437 ]
441438 } ) ;
442- console . log ( 'END EXEC----' ) ;
443439 assert . equal ( csv , csvTestData . withSpecifiedKeys . replace ( 'data.category,data.options.name' , 'Category,Option Name' ) ) ;
444440 } ) ;
445441
446442 it ( 'should allow titles to be specified when not unwinding arrays' , ( ) => {
447443 const csv = json2csv ( jsonTestData . unwind , {
448444 unwindArrays : true ,
449445 keys : [
450- { field : 'data.category' , title : 'Category' } ,
451- { field : 'data.options.name' , title : 'Option Name' }
446+ { field : 'data.category' , title : 'Category' } ,
447+ { field : 'data.options.name' , title : 'Option Name' }
452448 ]
453449 } ) ;
454450 assert . equal ( csv , csvTestData . unwindWithSpecifiedKeys . replace ( 'data.category,data.options.name' , 'Category,Option Name' ) ) ;
@@ -472,7 +468,7 @@ export function runTests() {
472468 const updatedCsv = csvTestData . unwind . replace ( ',data.options.name' , '' )
473469 . replace ( / , M a c B o o k ( P r o | A i r ) \d + / g, '' )
474470 . replace ( / , ( S u p e r | T u r b o ) c h a r g e r / g, '' )
475- // De-duplicate the lines since the field isn't unwound due to being excluded
471+ // De-duplicate the lines since the field isn't unwound due to being excluded
476472 . replace ( '5cf7ca3616c91100018844af,Computers\n' , '' )
477473 . replace ( '5cf7ca3616c91100018844bf,Cars\n' , '' ) ;
478474
@@ -572,7 +568,7 @@ export function runTests() {
572568 it ( 'should not escape nested dots in keys with nested dots in them if turned off via the option' , ( ) => {
573569 const updatedCsv = csvTestData . wildcardMatch . replace ( 'baz.a,baz.array' , 'baz.a,baz.b,baz.array' )
574570 . replace ( 'a,c' , 'a,b,c' ) ;
575-
571+
576572 const csv = json2csv ( jsonTestData . wildcardMatch , {
577573 keys : [ 'foo' , 'bar' , { field : 'baz' , wildcardMatch : true } ] ,
578574 } ) ;
@@ -583,7 +579,7 @@ export function runTests() {
583579 it ( 'should not escape nested dots in keys with nested dots in them if turned off via the option' , ( ) => {
584580 const updatedCsv = csvTestData . wildcardMatch . replace ( 'foo,bar,baz.a,baz.array' , 'foo,baz.a,baz.array,bar' )
585581 . replace ( 'foo,bar,a,c' , 'foo,a,c,bar' ) ;
586-
582+
587583 const csv = json2csv ( jsonTestData . wildcardMatch , {
588584 keys : [ 'foo' , { field : 'baz.a' , wildcardMatch : true } , 'bar' ] ,
589585 } ) ;
@@ -656,7 +652,7 @@ export function runTests() {
656652
657653 // Test cases for https://github.com/mrodrig/json-2-csv/issues/209
658654 it ( 'should left trim equals (=) if preventCsvInjection is specified' , ( ) => {
659- const csv = json2csv ( [ { name : '=Bob' } ] , {
655+ const csv = json2csv ( [ { name : '=Bob' } ] , {
660656 preventCsvInjection : true
661657 } ) ;
662658
@@ -666,7 +662,7 @@ export function runTests() {
666662 } ) ;
667663
668664 it ( 'should left trim plus (+) if preventCsvInjection is specified' , ( ) => {
669- const csv = json2csv ( [ { name : '+Bob' } ] , {
665+ const csv = json2csv ( [ { name : '+Bob' } ] , {
670666 preventCsvInjection : true
671667 } ) ;
672668
@@ -676,7 +672,7 @@ export function runTests() {
676672 } ) ;
677673
678674 it ( 'should left trim minus (-) if preventCsvInjection is specified' , ( ) => {
679- const csv = json2csv ( [ { name : '-Bob' } ] , {
675+ const csv = json2csv ( [ { name : '-Bob' } ] , {
680676 preventCsvInjection : true
681677 } ) ;
682678
@@ -686,7 +682,7 @@ export function runTests() {
686682 } ) ;
687683
688684 it ( 'should left trim at (@) if preventCsvInjection is specified' , ( ) => {
689- const csv = json2csv ( [ { name : '@Bob' } ] , {
685+ const csv = json2csv ( [ { name : '@Bob' } ] , {
690686 preventCsvInjection : true
691687 } ) ;
692688
@@ -696,7 +692,7 @@ export function runTests() {
696692 } ) ;
697693
698694 it ( 'should left trim tab (0x09) if preventCsvInjection is specified' , ( ) => {
699- const csv = json2csv ( [ { name : String . fromCharCode ( 9 ) + 'Bob' } ] , {
695+ const csv = json2csv ( [ { name : String . fromCharCode ( 9 ) + 'Bob' } ] , {
700696 preventCsvInjection : true
701697 } ) ;
702698
@@ -706,7 +702,7 @@ export function runTests() {
706702 } ) ;
707703
708704 it ( 'should left trim carriage return (0x0D) if preventCsvInjection is specified' , ( ) => {
709- const csv = json2csv ( [ { name : String . fromCharCode ( 13 ) + 'Bob' } ] , {
705+ const csv = json2csv ( [ { name : String . fromCharCode ( 13 ) + 'Bob' } ] , {
710706 preventCsvInjection : true
711707 } ) ;
712708
@@ -716,7 +712,7 @@ export function runTests() {
716712 } ) ;
717713
718714 it ( 'should left trim a combination of csv injection characters if preventCsvInjection is specified' , ( ) => {
719- const csv = json2csv ( [ { name : String . fromCharCode ( 9 ) + String . fromCharCode ( 13 ) + '=+-@Bob' } ] , {
715+ const csv = json2csv ( [ { name : String . fromCharCode ( 9 ) + String . fromCharCode ( 13 ) + '=+-@Bob' } ] , {
720716 preventCsvInjection : true
721717 } ) ;
722718
@@ -726,7 +722,7 @@ export function runTests() {
726722 } ) ;
727723
728724 it ( 'should not alter numbers by removing minus (-) even if preventCsvInjection is specified' , ( ) => {
729- const csv = json2csv ( [ { temperature : - 10 } ] , {
725+ const csv = json2csv ( [ { temperature : - 10 } ] , {
730726 preventCsvInjection : true
731727 } ) ;
732728
@@ -737,7 +733,7 @@ export function runTests() {
737733
738734 it ( 'should not left trim a combination of csv injection characters if preventCsvInjection is not specified' , ( ) => {
739735 const originalValue = String . fromCharCode ( 9 ) + String . fromCharCode ( 13 ) + '=+-@Bob' ;
740- const csv = json2csv ( [ { name : originalValue } ] , { } ) ;
736+ const csv = json2csv ( [ { name : originalValue } ] , { } ) ;
741737
742738 const expectedCsv = `name\n"${ originalValue } "` ;
743739
0 commit comments