convert-csv-to-json 4.13.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.github/workflows/ci-cd.yml +1 -1
  2. package/eslint.config.js +115 -0
  3. package/index.js +21 -5
  4. package/jsdoc.json +29 -4
  5. package/package.json +5 -3
  6. package/src/browserApi.js +4 -3
  7. package/src/csvToJson.js +3 -2
  8. package/src/csvToJsonAsync.js +2 -1
  9. package/src/util/errors.js +10 -2
  10. package/src/util/fileUtils.js +1 -0
  11. package/src/util/jsonUtils.js +1 -0
  12. package/src/util/stringUtils.js +5 -1
  13. package/.eslintignore +0 -3
  14. package/.eslintrc.json +0 -48
  15. package/docs/api/BrowserApi.html +0 -2435
  16. package/docs/api/BrowserApiError.html +0 -522
  17. package/docs/api/ConfigurationError.html +0 -594
  18. package/docs/api/CsvFormatError.html +0 -530
  19. package/docs/api/CsvParsingError.html +0 -384
  20. package/docs/api/CsvToJson.html +0 -3136
  21. package/docs/api/CsvToJsonAsync.html +0 -2672
  22. package/docs/api/FileOperationError.html +0 -270
  23. package/docs/api/FileUtils.html +0 -1012
  24. package/docs/api/InputValidationError.html +0 -293
  25. package/docs/api/JsonUtil.html +0 -340
  26. package/docs/api/JsonValidationError.html +0 -247
  27. package/docs/api/fonts/OpenSans-Bold-webfont.eot +0 -0
  28. package/docs/api/fonts/OpenSans-Bold-webfont.svg +0 -1830
  29. package/docs/api/fonts/OpenSans-Bold-webfont.woff +0 -0
  30. package/docs/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  31. package/docs/api/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  32. package/docs/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  33. package/docs/api/fonts/OpenSans-Italic-webfont.eot +0 -0
  34. package/docs/api/fonts/OpenSans-Italic-webfont.svg +0 -1830
  35. package/docs/api/fonts/OpenSans-Italic-webfont.woff +0 -0
  36. package/docs/api/fonts/OpenSans-Light-webfont.eot +0 -0
  37. package/docs/api/fonts/OpenSans-Light-webfont.svg +0 -1831
  38. package/docs/api/fonts/OpenSans-Light-webfont.woff +0 -0
  39. package/docs/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  40. package/docs/api/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  41. package/docs/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  42. package/docs/api/fonts/OpenSans-Regular-webfont.eot +0 -0
  43. package/docs/api/fonts/OpenSans-Regular-webfont.svg +0 -1831
  44. package/docs/api/fonts/OpenSans-Regular-webfont.woff +0 -0
  45. package/docs/api/global.html +0 -3315
  46. package/docs/api/index.html +0 -326
  47. package/docs/api/index.js.html +0 -341
  48. package/docs/api/scripts/linenumber.js +0 -25
  49. package/docs/api/scripts/prettify/Apache-License-2.0.txt +0 -202
  50. package/docs/api/scripts/prettify/lang-css.js +0 -2
  51. package/docs/api/scripts/prettify/prettify.js +0 -28
  52. package/docs/api/src_browserApi.js.html +0 -271
  53. package/docs/api/src_csvToJson.js.html +0 -605
  54. package/docs/api/src_csvToJsonAsync.js.html +0 -244
  55. package/docs/api/src_util_errors.js.html +0 -374
  56. package/docs/api/src_util_fileUtils.js.html +0 -147
  57. package/docs/api/src_util_jsonUtils.js.html +0 -75
  58. package/docs/api/src_util_stringUtils.js.html +0 -212
  59. package/docs/api/styles/jsdoc-default.css +0 -358
  60. package/docs/api/styles/prettify-jsdoc.css +0 -111
  61. package/docs/api/styles/prettify-tomorrow.css +0 -132
@@ -1,1012 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <title>JSDoc: Class: FileUtils</title>
6
-
7
- <script src="scripts/prettify/prettify.js"> </script>
8
- <script src="scripts/prettify/lang-css.js"> </script>
9
- <!--[if lt IE 9]>
10
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11
- <![endif]-->
12
- <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13
- <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14
- </head>
15
-
16
- <body>
17
-
18
- <div id="main">
19
-
20
- <h1 class="page-title">Class: FileUtils</h1>
21
-
22
-
23
-
24
-
25
-
26
-
27
- <section>
28
-
29
- <header>
30
-
31
- <h2><span class="attribs"><span class="type-signature"></span></span>FileUtils<span class="signature">()</span><span class="type-signature"></span></h2>
32
-
33
- <div class="class-description"><p>File I/O utilities for reading and writing CSV/JSON files
34
- Provides both synchronous and asynchronous file operations</p></div>
35
-
36
-
37
- </header>
38
-
39
- <article>
40
- <div class="container-overview">
41
-
42
-
43
-
44
-
45
- <h2>Constructor</h2>
46
-
47
-
48
-
49
- <h4 class="name" id="FileUtils"><span class="type-signature"></span>new FileUtils<span class="signature">()</span><span class="type-signature"></span></h4>
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
- <dl class="details">
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <dt class="tag-source">Source:</dt>
96
- <dd class="tag-source"><ul class="dummy"><li>
97
- <a href="src_util_fileUtils.js.html">src/util/fileUtils.js</a>, <a href="src_util_fileUtils.js.html#line10">line 10</a>
98
- </li></ul></dd>
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
- </dl>
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
- </div>
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
- <h3 class="subsection-title">Methods</h3>
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
- <h4 class="name" id="readFile"><span class="type-signature"></span>readFile<span class="signature">(fileInputName, encoding)</span><span class="type-signature"> &rarr; {string}</span></h4>
154
-
155
-
156
-
157
-
158
-
159
-
160
- <div class="description">
161
- <p>Read a file synchronously with specified encoding</p>
162
- </div>
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
- <h5>Parameters:</h5>
173
-
174
-
175
- <table class="params">
176
- <thead>
177
- <tr>
178
-
179
- <th>Name</th>
180
-
181
-
182
- <th>Type</th>
183
-
184
-
185
-
186
-
187
-
188
- <th class="last">Description</th>
189
- </tr>
190
- </thead>
191
-
192
- <tbody>
193
-
194
-
195
- <tr>
196
-
197
- <td class="name"><code>fileInputName</code></td>
198
-
199
-
200
- <td class="type">
201
-
202
-
203
- <span class="param-type">string</span>
204
-
205
-
206
-
207
- </td>
208
-
209
-
210
-
211
-
212
-
213
- <td class="description last"><p>Path to file to read</p></td>
214
- </tr>
215
-
216
-
217
-
218
- <tr>
219
-
220
- <td class="name"><code>encoding</code></td>
221
-
222
-
223
- <td class="type">
224
-
225
-
226
- <span class="param-type">string</span>
227
-
228
-
229
-
230
- </td>
231
-
232
-
233
-
234
-
235
-
236
- <td class="description last"><p>File encoding (e.g., 'utf8', 'latin1')</p></td>
237
- </tr>
238
-
239
-
240
- </tbody>
241
- </table>
242
-
243
-
244
-
245
-
246
-
247
-
248
- <dl class="details">
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
- <dt class="tag-source">Source:</dt>
276
- <dd class="tag-source"><ul class="dummy"><li>
277
- <a href="src_util_fileUtils.js.html">src/util/fileUtils.js</a>, <a href="src_util_fileUtils.js.html#line19">line 19</a>
278
- </li></ul></dd>
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
- </dl>
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
- <h5>Throws:</h5>
301
-
302
-
303
-
304
- <dl>
305
- <dt>
306
- <div class="param-desc">
307
- <p>If file read fails</p>
308
- </div>
309
- </dt>
310
- <dd></dd>
311
- <dt>
312
- <dl>
313
- <dt>
314
- Type
315
- </dt>
316
- <dd>
317
-
318
- <span class="param-type"><a href="FileOperationError.html">FileOperationError</a></span>
319
-
320
-
321
- </dd>
322
- </dl>
323
- </dt>
324
- <dd></dd>
325
- </dl>
326
-
327
-
328
-
329
-
330
-
331
- <h5>Returns:</h5>
332
-
333
-
334
- <div class="param-desc">
335
- <p>File contents as string</p>
336
- </div>
337
-
338
-
339
-
340
- <dl>
341
- <dt>
342
- Type
343
- </dt>
344
- <dd>
345
-
346
- <span class="param-type">string</span>
347
-
348
-
349
- </dd>
350
- </dl>
351
-
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
- <h4 class="name" id="readFileAsync"><span class="type-signature"></span>readFileAsync<span class="signature">(fileInputName, encoding)</span><span class="type-signature"> &rarr; {Promise.&lt;string>}</span></h4>
365
-
366
-
367
-
368
-
369
-
370
-
371
- <div class="description">
372
- <p>Read a file asynchronously with specified encoding
373
- Uses fs.promises when available, falls back to callback-based API</p>
374
- </div>
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
-
384
- <h5>Parameters:</h5>
385
-
386
-
387
- <table class="params">
388
- <thead>
389
- <tr>
390
-
391
- <th>Name</th>
392
-
393
-
394
- <th>Type</th>
395
-
396
-
397
-
398
-
399
- <th>Default</th>
400
-
401
-
402
- <th class="last">Description</th>
403
- </tr>
404
- </thead>
405
-
406
- <tbody>
407
-
408
-
409
- <tr>
410
-
411
- <td class="name"><code>fileInputName</code></td>
412
-
413
-
414
- <td class="type">
415
-
416
-
417
- <span class="param-type">string</span>
418
-
419
-
420
-
421
- </td>
422
-
423
-
424
-
425
-
426
- <td class="default">
427
-
428
- </td>
429
-
430
-
431
- <td class="description last"><p>Path to file to read</p></td>
432
- </tr>
433
-
434
-
435
-
436
- <tr>
437
-
438
- <td class="name"><code>encoding</code></td>
439
-
440
-
441
- <td class="type">
442
-
443
-
444
- <span class="param-type">string</span>
445
-
446
-
447
-
448
- </td>
449
-
450
-
451
-
452
-
453
- <td class="default">
454
-
455
- utf8
456
-
457
- </td>
458
-
459
-
460
- <td class="description last"><p>File encoding (default: 'utf8')</p></td>
461
- </tr>
462
-
463
-
464
- </tbody>
465
- </table>
466
-
467
-
468
-
469
-
470
-
471
-
472
- <dl class="details">
473
-
474
-
475
-
476
-
477
-
478
-
479
-
480
-
481
-
482
-
483
-
484
-
485
-
486
-
487
-
488
-
489
-
490
-
491
-
492
-
493
-
494
-
495
-
496
-
497
-
498
-
499
- <dt class="tag-source">Source:</dt>
500
- <dd class="tag-source"><ul class="dummy"><li>
501
- <a href="src_util_fileUtils.js.html">src/util/fileUtils.js</a>, <a href="src_util_fileUtils.js.html#line35">line 35</a>
502
- </li></ul></dd>
503
-
504
-
505
-
506
-
507
-
508
-
509
-
510
- </dl>
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
- <h5>Throws:</h5>
525
-
526
-
527
-
528
- <dl>
529
- <dt>
530
- <div class="param-desc">
531
- <p>If file read fails</p>
532
- </div>
533
- </dt>
534
- <dd></dd>
535
- <dt>
536
- <dl>
537
- <dt>
538
- Type
539
- </dt>
540
- <dd>
541
-
542
- <span class="param-type"><a href="FileOperationError.html">FileOperationError</a></span>
543
-
544
-
545
- </dd>
546
- </dl>
547
- </dt>
548
- <dd></dd>
549
- </dl>
550
-
551
-
552
-
553
-
554
-
555
- <h5>Returns:</h5>
556
-
557
-
558
- <div class="param-desc">
559
- <p>Promise resolving to file contents</p>
560
- </div>
561
-
562
-
563
-
564
- <dl>
565
- <dt>
566
- Type
567
- </dt>
568
- <dd>
569
-
570
- <span class="param-type">Promise.&lt;string></span>
571
-
572
-
573
- </dd>
574
- </dl>
575
-
576
-
577
-
578
-
579
-
580
-
581
-
582
-
583
-
584
-
585
-
586
-
587
-
588
- <h4 class="name" id="writeFile"><span class="type-signature"></span>writeFile<span class="signature">(json, fileOutputName)</span><span class="type-signature"></span></h4>
589
-
590
-
591
-
592
-
593
-
594
-
595
- <div class="description">
596
- <p>Write content to a file synchronously
597
- Logs confirmation message to console on success</p>
598
- </div>
599
-
600
-
601
-
602
-
603
-
604
-
605
-
606
-
607
-
608
- <h5>Parameters:</h5>
609
-
610
-
611
- <table class="params">
612
- <thead>
613
- <tr>
614
-
615
- <th>Name</th>
616
-
617
-
618
- <th>Type</th>
619
-
620
-
621
-
622
-
623
-
624
- <th class="last">Description</th>
625
- </tr>
626
- </thead>
627
-
628
- <tbody>
629
-
630
-
631
- <tr>
632
-
633
- <td class="name"><code>json</code></td>
634
-
635
-
636
- <td class="type">
637
-
638
-
639
- <span class="param-type">string</span>
640
-
641
-
642
-
643
- </td>
644
-
645
-
646
-
647
-
648
-
649
- <td class="description last"><p>Content to write to file</p></td>
650
- </tr>
651
-
652
-
653
-
654
- <tr>
655
-
656
- <td class="name"><code>fileOutputName</code></td>
657
-
658
-
659
- <td class="type">
660
-
661
-
662
- <span class="param-type">string</span>
663
-
664
-
665
-
666
- </td>
667
-
668
-
669
-
670
-
671
-
672
- <td class="description last"><p>Path to output file</p></td>
673
- </tr>
674
-
675
-
676
- </tbody>
677
- </table>
678
-
679
-
680
-
681
-
682
-
683
-
684
- <dl class="details">
685
-
686
-
687
-
688
-
689
-
690
-
691
-
692
-
693
-
694
-
695
-
696
-
697
-
698
-
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
- <dt class="tag-source">Source:</dt>
712
- <dd class="tag-source"><ul class="dummy"><li>
713
- <a href="src_util_fileUtils.js.html">src/util/fileUtils.js</a>, <a href="src_util_fileUtils.js.html#line62">line 62</a>
714
- </li></ul></dd>
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
- </dl>
723
-
724
-
725
-
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
-
734
-
735
-
736
- <h5>Throws:</h5>
737
-
738
-
739
-
740
- <dl>
741
- <dt>
742
- <div class="param-desc">
743
- <p>If file write fails</p>
744
- </div>
745
- </dt>
746
- <dd></dd>
747
- <dt>
748
- <dl>
749
- <dt>
750
- Type
751
- </dt>
752
- <dd>
753
-
754
- <span class="param-type"><a href="FileOperationError.html">FileOperationError</a></span>
755
-
756
-
757
- </dd>
758
- </dl>
759
- </dt>
760
- <dd></dd>
761
- </dl>
762
-
763
-
764
-
765
-
766
-
767
-
768
-
769
-
770
-
771
-
772
-
773
-
774
-
775
-
776
-
777
-
778
- <h4 class="name" id="writeFileAsync"><span class="type-signature"></span>writeFileAsync<span class="signature">(json, fileOutputName)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
779
-
780
-
781
-
782
-
783
-
784
-
785
- <div class="description">
786
- <p>Write content to a file asynchronously
787
- Uses fs.promises when available, falls back to callback-based API</p>
788
- </div>
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
-
797
-
798
- <h5>Parameters:</h5>
799
-
800
-
801
- <table class="params">
802
- <thead>
803
- <tr>
804
-
805
- <th>Name</th>
806
-
807
-
808
- <th>Type</th>
809
-
810
-
811
-
812
-
813
-
814
- <th class="last">Description</th>
815
- </tr>
816
- </thead>
817
-
818
- <tbody>
819
-
820
-
821
- <tr>
822
-
823
- <td class="name"><code>json</code></td>
824
-
825
-
826
- <td class="type">
827
-
828
-
829
- <span class="param-type">string</span>
830
-
831
-
832
-
833
- </td>
834
-
835
-
836
-
837
-
838
-
839
- <td class="description last"><p>Content to write to file</p></td>
840
- </tr>
841
-
842
-
843
-
844
- <tr>
845
-
846
- <td class="name"><code>fileOutputName</code></td>
847
-
848
-
849
- <td class="type">
850
-
851
-
852
- <span class="param-type">string</span>
853
-
854
-
855
-
856
- </td>
857
-
858
-
859
-
860
-
861
-
862
- <td class="description last"><p>Path to output file</p></td>
863
- </tr>
864
-
865
-
866
- </tbody>
867
- </table>
868
-
869
-
870
-
871
-
872
-
873
-
874
- <dl class="details">
875
-
876
-
877
-
878
-
879
-
880
-
881
-
882
-
883
-
884
-
885
-
886
-
887
-
888
-
889
-
890
-
891
-
892
-
893
-
894
-
895
-
896
-
897
-
898
-
899
-
900
-
901
- <dt class="tag-source">Source:</dt>
902
- <dd class="tag-source"><ul class="dummy"><li>
903
- <a href="src_util_fileUtils.js.html">src/util/fileUtils.js</a>, <a href="src_util_fileUtils.js.html#line80">line 80</a>
904
- </li></ul></dd>
905
-
906
-
907
-
908
-
909
-
910
-
911
-
912
- </dl>
913
-
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
-
923
-
924
-
925
-
926
- <h5>Throws:</h5>
927
-
928
-
929
-
930
- <dl>
931
- <dt>
932
- <div class="param-desc">
933
- <p>If file write fails</p>
934
- </div>
935
- </dt>
936
- <dd></dd>
937
- <dt>
938
- <dl>
939
- <dt>
940
- Type
941
- </dt>
942
- <dd>
943
-
944
- <span class="param-type"><a href="FileOperationError.html">FileOperationError</a></span>
945
-
946
-
947
- </dd>
948
- </dl>
949
- </dt>
950
- <dd></dd>
951
- </dl>
952
-
953
-
954
-
955
-
956
-
957
- <h5>Returns:</h5>
958
-
959
-
960
- <div class="param-desc">
961
- <p>Promise that resolves when write completes</p>
962
- </div>
963
-
964
-
965
-
966
- <dl>
967
- <dt>
968
- Type
969
- </dt>
970
- <dd>
971
-
972
- <span class="param-type">Promise.&lt;void></span>
973
-
974
-
975
- </dd>
976
- </dl>
977
-
978
-
979
-
980
-
981
-
982
-
983
-
984
-
985
-
986
-
987
-
988
-
989
-
990
- </article>
991
-
992
- </section>
993
-
994
-
995
-
996
-
997
- </div>
998
-
999
- <nav>
1000
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BrowserApi.html">BrowserApi</a></li><li><a href="BrowserApiError.html">BrowserApiError</a></li><li><a href="ConfigurationError.html">ConfigurationError</a></li><li><a href="CsvFormatError.html">CsvFormatError</a></li><li><a href="CsvParsingError.html">CsvParsingError</a></li><li><a href="CsvToJson.html">CsvToJson</a></li><li><a href="CsvToJsonAsync.html">CsvToJsonAsync</a></li><li><a href="FileOperationError.html">FileOperationError</a></li><li><a href="FileUtils.html">FileUtils</a></li><li><a href="InputValidationError.html">InputValidationError</a></li><li><a href="JsonUtil.html">JsonUtil</a></li><li><a href="JsonValidationError.html">JsonValidationError</a></li></ul><h3>Global</h3><ul><li><a href="global.html#asciiEncoding">asciiEncoding</a></li><li><a href="global.html#base64Encoding">base64Encoding</a></li><li><a href="global.html#browser">browser</a></li><li><a href="global.html#csvStringToJson">csvStringToJson</a></li><li><a href="global.html#csvStringToJsonStringified">csvStringToJsonStringified</a></li><li><a href="global.html#csvToJsonAsync">csvToJsonAsync</a></li><li><a href="global.html#customEncoding">customEncoding</a></li><li><a href="global.html#fieldDelimiter">fieldDelimiter</a></li><li><a href="global.html#formatValueByType">formatValueByType</a></li><li><a href="global.html#generateJsonFileFromCsv">generateJsonFileFromCsv</a></li><li><a href="global.html#getJsonFromCsv">getJsonFromCsv</a></li><li><a href="global.html#hexEncoding">hexEncoding</a></li><li><a href="global.html#indexHeader">indexHeader</a></li><li><a href="global.html#latin1Encoding">latin1Encoding</a></li><li><a href="global.html#mapRows">mapRows</a></li><li><a href="global.html#parseSubArray">parseSubArray</a></li><li><a href="global.html#supportQuotedField">supportQuotedField</a></li><li><a href="global.html#trimHeaderFieldWhiteSpace">trimHeaderFieldWhiteSpace</a></li><li><a href="global.html#ucs2Encoding">ucs2Encoding</a></li><li><a href="global.html#utf16leEncoding">utf16leEncoding</a></li><li><a href="global.html#utf8Encoding">utf8Encoding</a></li></ul>
1001
- </nav>
1002
-
1003
- <br class="clear">
1004
-
1005
- <footer>
1006
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.5</a> on Fri Mar 20 2026 16:08:52 GMT+0000 (Coordinated Universal Time)
1007
- </footer>
1008
-
1009
- <script> prettyPrint(); </script>
1010
- <script src="scripts/linenumber.js"> </script>
1011
- </body>
1012
- </html>