convert-csv-to-json 4.13.0 → 4.14.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.
- package/.github/workflows/ci-cd.yml +1 -1
- package/docs/api/BrowserApi.html +1255 -1028
- package/docs/api/BrowserApiError.html +326 -179
- package/docs/api/ConfigurationError.html +375 -224
- package/docs/api/CsvFormatError.html +334 -187
- package/docs/api/CsvParsingError.html +259 -132
- package/docs/api/CsvToJson.html +1545 -1314
- package/docs/api/CsvToJsonAsync.html +1356 -1148
- package/docs/api/FileOperationError.html +213 -101
- package/docs/api/FileUtils.html +568 -430
- package/docs/api/InputValidationError.html +229 -115
- package/docs/api/JsonUtil.html +222 -110
- package/docs/api/JsonValidationError.html +197 -87
- package/docs/api/StringUtils.html +833 -0
- package/docs/api/global.html +1537 -1354
- package/docs/api/index.html +114 -26
- package/docs/api/index.js.html +137 -31
- package/docs/api/scripts/app.min.js +1 -0
- package/docs/api/scripts/linenumber.js +10 -9
- package/docs/api/scripts/search.js +39 -0
- package/docs/api/src_browserApi.js.html +120 -29
- package/docs/api/src_csvToJson.js.html +119 -28
- package/docs/api/src_csvToJsonAsync.js.html +118 -27
- package/docs/api/src_util_errors.js.html +126 -28
- package/docs/api/src_util_fileUtils.js.html +117 -26
- package/docs/api/src_util_jsonUtils.js.html +117 -26
- package/docs/api/src_util_stringUtils.js.html +121 -27
- package/docs/api/styles/app.min.css +1 -0
- package/docs/api/styles/iframe.css +13 -0
- package/docs/api/styles/reset.css +44 -0
- package/eslint.config.js +115 -0
- package/index.js +21 -5
- package/jsdoc.json +29 -4
- package/package.json +5 -3
- package/src/browserApi.js +4 -3
- package/src/csvToJson.js +3 -2
- package/src/csvToJsonAsync.js +2 -1
- package/src/util/errors.js +10 -2
- package/src/util/fileUtils.js +1 -0
- package/src/util/jsonUtils.js +1 -0
- package/src/util/stringUtils.js +5 -1
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -48
- package/docs/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/api/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/api/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/api/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/api/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/api/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/api/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/api/scripts/prettify/lang-css.js +0 -2
- package/docs/api/scripts/prettify/prettify.js +0 -28
- package/docs/api/styles/jsdoc-default.css +0 -358
package/docs/api/index.html
CHANGED
|
@@ -1,26 +1,107 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<title> Home</title>
|
|
9
|
+
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
|
11
|
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
|
12
|
+
<script src="./build/entry.js"></script>
|
|
13
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
14
|
+
<!--[if lt IE 9]>
|
|
15
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
16
|
+
<![endif]-->
|
|
17
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
|
18
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
|
19
|
+
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
|
20
|
+
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
|
21
|
+
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
|
22
|
+
<link type="text/css" rel="stylesheet" href="./node_modules/better-docs/css/better-docs.css">
|
|
23
|
+
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
|
|
26
|
+
</head>
|
|
17
27
|
|
|
18
|
-
<div id="main">
|
|
19
28
|
|
|
20
|
-
<h1 class="page-title">Home</h1>
|
|
21
29
|
|
|
30
|
+
<body class="layout small-header">
|
|
31
|
+
<div id="stickyNavbarOverlay"></div>
|
|
22
32
|
|
|
23
33
|
|
|
34
|
+
<div class="top-nav">
|
|
35
|
+
<div class="inner">
|
|
36
|
+
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
|
37
|
+
<span aria-hidden="true"></span>
|
|
38
|
+
<span aria-hidden="true"></span>
|
|
39
|
+
<span aria-hidden="true"></span>
|
|
40
|
+
</a>
|
|
41
|
+
<div class="logo">
|
|
42
|
+
|
|
43
|
+
<a class="image" href="index.html">
|
|
44
|
+
<img src="https://raw.githubusercontent.com/iuccio/CSVtoJSON/master/CSVtoJSON.png" alt="logo">
|
|
45
|
+
</a>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<a href="index.html">
|
|
49
|
+
<h1 class="navbar-item">Convert CSV to JSON</h1>
|
|
50
|
+
</a>
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
<div class="menu">
|
|
54
|
+
|
|
55
|
+
<div class="navigation">
|
|
56
|
+
<a
|
|
57
|
+
href="index.html"
|
|
58
|
+
class="link"
|
|
59
|
+
>
|
|
60
|
+
Documentation
|
|
61
|
+
</a>
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<a
|
|
66
|
+
class="link user-link "
|
|
67
|
+
href="https://github.com/iuccio/CSVtoJSON"
|
|
68
|
+
>
|
|
69
|
+
GitHub
|
|
70
|
+
</a>
|
|
71
|
+
|
|
72
|
+
<a
|
|
73
|
+
class="link user-link "
|
|
74
|
+
href="https://www.npmjs.com/package/convert-csv-to-json"
|
|
75
|
+
>
|
|
76
|
+
NPM
|
|
77
|
+
</a>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div id="main">
|
|
86
|
+
<div
|
|
87
|
+
class="sidebar "
|
|
88
|
+
id="sidebarNav"
|
|
89
|
+
>
|
|
90
|
+
|
|
91
|
+
<nav>
|
|
92
|
+
|
|
93
|
+
<h2><a href="index.html">Documentation</a></h2><div class="category"></div><div class="category"><h2>1-Core API</h2><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#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></div><div class="category"><h2>2-Sync</h2><h3>Classes</h3><ul><li><a href="CsvToJson.html">CsvToJson</a></li></ul></div><div class="category"><h2>3-Async</h2><h3>Classes</h3><ul><li><a href="CsvToJsonAsync.html">CsvToJsonAsync</a></li></ul></div><div class="category"><h2>4-Browser</h2><h3>Classes</h3><ul><li><a href="BrowserApi.html">BrowserApi</a></li></ul></div><div class="category"><h2>Error Classes</h2><h3>Classes</h3><ul><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="FileOperationError.html">FileOperationError</a></li><li><a href="InputValidationError.html">InputValidationError</a></li><li><a href="JsonValidationError.html">JsonValidationError</a></li></ul></div><div class="category"><h2>Utilities</h2><h3>Classes</h3><ul><li><a href="FileUtils.html">FileUtils</a></li><li><a href="JsonUtil.html">JsonUtil</a></li><li><a href="StringUtils.html">StringUtils</a></li></ul></div>
|
|
94
|
+
|
|
95
|
+
</nav>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="core" id="main-content-wrapper">
|
|
98
|
+
<div class="content">
|
|
99
|
+
<header class="page-title">
|
|
100
|
+
<p></p>
|
|
101
|
+
<h1>Home</h1>
|
|
102
|
+
</header>
|
|
103
|
+
|
|
104
|
+
|
|
24
105
|
|
|
25
106
|
|
|
26
107
|
|
|
@@ -308,19 +389,26 @@ async function processCSV() {
|
|
|
308
389
|
|
|
309
390
|
|
|
310
391
|
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
<
|
|
314
|
-
|
|
315
|
-
</
|
|
316
|
-
|
|
317
|
-
<
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<footer class="footer">
|
|
395
|
+
<div class="content has-text-centered">
|
|
396
|
+
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a></p>
|
|
397
|
+
<p class="sidebar-created-by">
|
|
398
|
+
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
|
|
399
|
+
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
|
|
400
|
+
</p>
|
|
401
|
+
</div>
|
|
402
|
+
</footer>
|
|
403
|
+
|
|
404
|
+
</div>
|
|
405
|
+
<div id="side-nav" class="side-nav">
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
<script src="scripts/app.min.js"></script>
|
|
409
|
+
<script>PR.prettyPrint();</script>
|
|
410
|
+
<script src="scripts/linenumber.js"> </script>
|
|
318
411
|
|
|
319
|
-
<footer>
|
|
320
|
-
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)
|
|
321
|
-
</footer>
|
|
322
412
|
|
|
323
|
-
<script> prettyPrint(); </script>
|
|
324
|
-
<script src="scripts/linenumber.js"> </script>
|
|
325
413
|
</body>
|
|
326
414
|
</html>
|
package/docs/api/index.js.html
CHANGED
|
@@ -1,26 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
<!DOCTYPE html>
|
|
2
4
|
<html lang="en">
|
|
5
|
+
|
|
3
6
|
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
|
+
<title> index.js</title>
|
|
11
|
+
|
|
12
|
+
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
|
13
|
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
|
14
|
+
<script src="./build/entry.js"></script>
|
|
15
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
16
|
+
<!--[if lt IE 9]>
|
|
17
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
18
|
+
<![endif]-->
|
|
19
|
+
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700|Inconsolata,700" rel="stylesheet">
|
|
20
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
|
21
|
+
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
|
22
|
+
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
|
23
|
+
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
|
24
|
+
<link type="text/css" rel="stylesheet" href="./node_modules/better-docs/css/better-docs.css">
|
|
25
|
+
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
14
28
|
</head>
|
|
15
29
|
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
30
|
|
|
20
|
-
<h1 class="page-title">Source: index.js</h1>
|
|
21
31
|
|
|
32
|
+
<body class="layout small-header">
|
|
33
|
+
<div id="stickyNavbarOverlay"></div>
|
|
22
34
|
|
|
23
35
|
|
|
36
|
+
<div class="top-nav">
|
|
37
|
+
<div class="inner">
|
|
38
|
+
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
|
39
|
+
<span aria-hidden="true"></span>
|
|
40
|
+
<span aria-hidden="true"></span>
|
|
41
|
+
<span aria-hidden="true"></span>
|
|
42
|
+
</a>
|
|
43
|
+
<div class="logo">
|
|
44
|
+
|
|
45
|
+
<a class="image" href="index.html">
|
|
46
|
+
<img src="https://raw.githubusercontent.com/iuccio/CSVtoJSON/master/CSVtoJSON.png" alt="logo">
|
|
47
|
+
</a>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<a href="index.html">
|
|
51
|
+
<h1 class="navbar-item">Convert CSV to JSON</h1>
|
|
52
|
+
</a>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
<div class="menu">
|
|
56
|
+
|
|
57
|
+
<div class="navigation">
|
|
58
|
+
<a
|
|
59
|
+
href="index.html"
|
|
60
|
+
class="link"
|
|
61
|
+
>
|
|
62
|
+
Documentation
|
|
63
|
+
</a>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<a
|
|
68
|
+
class="link user-link "
|
|
69
|
+
href="https://github.com/iuccio/CSVtoJSON"
|
|
70
|
+
>
|
|
71
|
+
GitHub
|
|
72
|
+
</a>
|
|
73
|
+
|
|
74
|
+
<a
|
|
75
|
+
class="link user-link "
|
|
76
|
+
href="https://www.npmjs.com/package/convert-csv-to-json"
|
|
77
|
+
>
|
|
78
|
+
NPM
|
|
79
|
+
</a>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div id="main">
|
|
88
|
+
<div
|
|
89
|
+
class="sidebar "
|
|
90
|
+
id="sidebarNav"
|
|
91
|
+
>
|
|
92
|
+
|
|
93
|
+
<nav>
|
|
94
|
+
|
|
95
|
+
<h2><a href="index.html">Documentation</a></h2><div class="category"></div><div class="category"><h2>1-Core API</h2><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#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></div><div class="category"><h2>2-Sync</h2><h3>Classes</h3><ul><li><a href="CsvToJson.html">CsvToJson</a></li></ul></div><div class="category"><h2>3-Async</h2><h3>Classes</h3><ul><li><a href="CsvToJsonAsync.html">CsvToJsonAsync</a></li></ul></div><div class="category"><h2>4-Browser</h2><h3>Classes</h3><ul><li><a href="BrowserApi.html">BrowserApi</a></li></ul></div><div class="category"><h2>Error Classes</h2><h3>Classes</h3><ul><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="FileOperationError.html">FileOperationError</a></li><li><a href="InputValidationError.html">InputValidationError</a></li><li><a href="JsonValidationError.html">JsonValidationError</a></li></ul></div><div class="category"><h2>Utilities</h2><h3>Classes</h3><ul><li><a href="FileUtils.html">FileUtils</a></li><li><a href="JsonUtil.html">JsonUtil</a></li><li><a href="StringUtils.html">StringUtils</a></li></ul></div>
|
|
96
|
+
|
|
97
|
+
</nav>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="core" id="main-content-wrapper">
|
|
100
|
+
<div class="content">
|
|
101
|
+
<header class="page-title">
|
|
102
|
+
<p>Source</p>
|
|
103
|
+
<h1>index.js</h1>
|
|
104
|
+
</header>
|
|
105
|
+
|
|
106
|
+
|
|
24
107
|
|
|
25
108
|
|
|
26
109
|
|
|
@@ -50,6 +133,7 @@ const encodingOps = {
|
|
|
50
133
|
/**
|
|
51
134
|
* Enable or disable automatic type formatting for values
|
|
52
135
|
* Converts numeric strings to numbers, 'true'/'false' to booleans
|
|
136
|
+
* @category 1-Core API
|
|
53
137
|
* @param {boolean} active - Whether to format values by type (default: true)
|
|
54
138
|
* @returns {object} Module context for method chaining
|
|
55
139
|
*/
|
|
@@ -61,6 +145,7 @@ exports.formatValueByType = function (active = true) {
|
|
|
61
145
|
/**
|
|
62
146
|
* Enable or disable support for RFC 4180 quoted fields
|
|
63
147
|
* When enabled, fields wrapped in double quotes can contain delimiters and newlines
|
|
148
|
+
* @category 1-Core API
|
|
64
149
|
* @param {boolean} active - Whether to support quoted fields (default: false)
|
|
65
150
|
* @returns {object} Module context for method chaining
|
|
66
151
|
*/
|
|
@@ -70,6 +155,7 @@ exports.supportQuotedField = function (active = false) {
|
|
|
70
155
|
};
|
|
71
156
|
/**
|
|
72
157
|
* Set the field delimiter character used to separate CSV fields
|
|
158
|
+
* @category 1-Core API
|
|
73
159
|
* @param {string} delimiter - Character(s) to use as field separator (default: ',')
|
|
74
160
|
* @returns {object} Module context for method chaining
|
|
75
161
|
*/
|
|
@@ -82,6 +168,7 @@ exports.fieldDelimiter = function (delimiter) {
|
|
|
82
168
|
* Configure whitespace handling in CSV header field names
|
|
83
169
|
* When active, removes all whitespace from header names (e.g., "My Name" → "MyName")
|
|
84
170
|
* When inactive, only trims leading and trailing whitespace
|
|
171
|
+
* @category 1-Core API
|
|
85
172
|
* @param {boolean} active - Whether to remove all whitespace from headers (default: false)
|
|
86
173
|
* @returns {object} Module context for method chaining
|
|
87
174
|
*/
|
|
@@ -93,6 +180,7 @@ exports.trimHeaderFieldWhiteSpace = function (active = false) {
|
|
|
93
180
|
/**
|
|
94
181
|
* Set the row index where CSV headers are located
|
|
95
182
|
* Use this if headers are not on the first line (row 0)
|
|
183
|
+
* @category 1-Core API
|
|
96
184
|
* @param {number} index - Zero-based row index containing headers
|
|
97
185
|
* @returns {object} Module context for method chaining
|
|
98
186
|
*/
|
|
@@ -104,6 +192,7 @@ exports.indexHeader = function (index) {
|
|
|
104
192
|
/**
|
|
105
193
|
* Configure sub-array parsing for special field values
|
|
106
194
|
* Fields bracketed by delimiter and containing separator are parsed into arrays
|
|
195
|
+
* @category 1-Core API
|
|
107
196
|
* @param {string} delimiter - Bracket character (default: '*')
|
|
108
197
|
* @param {string} separator - Item separator within brackets (default: ',')
|
|
109
198
|
* @returns {object} Module context for method chaining
|
|
@@ -120,6 +209,7 @@ exports.parseSubArray = function (delimiter, separator) {
|
|
|
120
209
|
/**
|
|
121
210
|
* Set custom file encoding for reading CSV files
|
|
122
211
|
* Useful for non-UTF8 encoded files
|
|
212
|
+
* @category 1-Core API
|
|
123
213
|
* @param {string} encoding - Node.js supported encoding (e.g., 'utf8', 'latin1', 'ascii')
|
|
124
214
|
* @returns {object} Module context for method chaining
|
|
125
215
|
*/
|
|
@@ -130,6 +220,7 @@ exports.customEncoding = function (encoding) {
|
|
|
130
220
|
|
|
131
221
|
/**
|
|
132
222
|
* Set UTF-8 encoding (default encoding)
|
|
223
|
+
* @category 1-Core API
|
|
133
224
|
* @returns {object} Module context for method chaining
|
|
134
225
|
*/
|
|
135
226
|
exports.utf8Encoding = function utf8Encoding() {
|
|
@@ -139,6 +230,7 @@ exports.utf8Encoding = function utf8Encoding() {
|
|
|
139
230
|
|
|
140
231
|
/**
|
|
141
232
|
* Set UCS-2 encoding for reading files
|
|
233
|
+
* @category 1-Core API
|
|
142
234
|
* @returns {object} Module context for method chaining
|
|
143
235
|
*/
|
|
144
236
|
exports.ucs2Encoding = function () {
|
|
@@ -148,6 +240,7 @@ exports.ucs2Encoding = function () {
|
|
|
148
240
|
|
|
149
241
|
/**
|
|
150
242
|
* Set UTF-16 LE encoding for reading files
|
|
243
|
+
* @category 1-Core API
|
|
151
244
|
* @returns {object} Module context for method chaining
|
|
152
245
|
*/
|
|
153
246
|
exports.utf16leEncoding = function () {
|
|
@@ -157,6 +250,7 @@ exports.utf16leEncoding = function () {
|
|
|
157
250
|
|
|
158
251
|
/**
|
|
159
252
|
* Set Latin-1 (ISO-8859-1) encoding for reading files
|
|
253
|
+
* @category 1-Core API
|
|
160
254
|
* @returns {object} Module context for method chaining
|
|
161
255
|
*/
|
|
162
256
|
exports.latin1Encoding = function () {
|
|
@@ -166,6 +260,7 @@ exports.latin1Encoding = function () {
|
|
|
166
260
|
|
|
167
261
|
/**
|
|
168
262
|
* Set ASCII encoding for reading files
|
|
263
|
+
* @category 1-Core API
|
|
169
264
|
* @returns {object} Module context for method chaining
|
|
170
265
|
*/
|
|
171
266
|
exports.asciiEncoding = function () {
|
|
@@ -175,6 +270,7 @@ exports.asciiEncoding = function () {
|
|
|
175
270
|
|
|
176
271
|
/**
|
|
177
272
|
* Set Base64 encoding for reading files
|
|
273
|
+
* @category 1-Core API
|
|
178
274
|
* @returns {object} Module context for method chaining
|
|
179
275
|
*/
|
|
180
276
|
exports.base64Encoding = function () {
|
|
@@ -184,6 +280,7 @@ exports.base64Encoding = function () {
|
|
|
184
280
|
|
|
185
281
|
/**
|
|
186
282
|
* Set Hex encoding for reading files
|
|
283
|
+
* @category 1-Core API
|
|
187
284
|
* @returns {object} Module context for method chaining
|
|
188
285
|
*/
|
|
189
286
|
exports.hexEncoding = function () {
|
|
@@ -195,7 +292,8 @@ exports.hexEncoding = function () {
|
|
|
195
292
|
* Set a mapper function to transform each row after conversion
|
|
196
293
|
* The mapper function receives (row, index) where row is the JSON object
|
|
197
294
|
* and index is the 0-based row number. Return null/undefined to filter out rows.
|
|
198
|
-
* @
|
|
295
|
+
* @category 1-Core API
|
|
296
|
+
* @param {function(object, number): (object|null)} mapperFn - Function to transform each row
|
|
199
297
|
* @returns {object} Module context for method chaining
|
|
200
298
|
* @example
|
|
201
299
|
* csvToJson
|
|
@@ -214,6 +312,7 @@ exports.mapRows = function (mapperFn) {
|
|
|
214
312
|
* @throws {Error} If inputFileName or outputFileName is not defined
|
|
215
313
|
* @throws {FileOperationError} If file operations fail
|
|
216
314
|
* @throws {CsvFormatError} If CSV is malformed
|
|
315
|
+
* @category 1-Core API
|
|
217
316
|
* @example
|
|
218
317
|
* const csvToJson = require('convert-csv-to-json');
|
|
219
318
|
* csvToJson.generateJsonFileFromCsv('input.csv', 'output.json');
|
|
@@ -235,6 +334,7 @@ exports.generateJsonFileFromCsv = function(inputFileName, outputFileName) {
|
|
|
235
334
|
* @throws {Error} If inputFileName is not defined
|
|
236
335
|
* @throws {FileOperationError} If file read fails
|
|
237
336
|
* @throws {CsvFormatError} If CSV is malformed
|
|
337
|
+
* @category 1-Core API
|
|
238
338
|
* @example
|
|
239
339
|
* const csvToJson = require('convert-csv-to-json');
|
|
240
340
|
* const rows = csvToJson.getJsonFromCsv('resource/input.csv');
|
|
@@ -256,6 +356,7 @@ exports.getJsonFromCsv = function(inputFileName) {
|
|
|
256
356
|
* @throws {InputValidationError} If input is invalid
|
|
257
357
|
* @throws {FileOperationError} If file read fails
|
|
258
358
|
* @throws {CsvFormatError} If CSV is malformed
|
|
359
|
+
* @category 1-Core API
|
|
259
360
|
* @example
|
|
260
361
|
* const csvToJson = require('convert-csv-to-json');
|
|
261
362
|
* const data = await csvToJson.getJsonFromCsvAsync('resource/input.csv');
|
|
@@ -285,6 +386,7 @@ Object.assign(exports, {
|
|
|
285
386
|
* @returns {Array<object>} Array of objects representing CSV rows
|
|
286
387
|
* @throws {InputValidationError} If csvString is invalid
|
|
287
388
|
* @throws {CsvFormatError} If CSV is malformed
|
|
389
|
+
* @category 1-Core API
|
|
288
390
|
* @example
|
|
289
391
|
* const csvToJson = require('convert-csv-to-json');
|
|
290
392
|
* const rows = csvToJson.csvStringToJson('name,age\nAlice,30');
|
|
@@ -301,6 +403,7 @@ exports.csvStringToJson = function(csvString) {
|
|
|
301
403
|
* @throws {InputValidationError} If csvString is invalid
|
|
302
404
|
* @throws {CsvFormatError} If CSV is malformed
|
|
303
405
|
* @throws {JsonValidationError} If JSON generation fails
|
|
406
|
+
* @category 1-Core API
|
|
304
407
|
*/
|
|
305
408
|
exports.csvStringToJsonStringified = function(csvString) {
|
|
306
409
|
if (csvString === undefined || csvString === null) {
|
|
@@ -311,10 +414,6 @@ exports.csvStringToJsonStringified = function(csvString) {
|
|
|
311
414
|
|
|
312
415
|
|
|
313
416
|
|
|
314
|
-
/**
|
|
315
|
-
* Browser API
|
|
316
|
-
* Provides parsing helpers suitable for browser environments (parsing strings and File/Blob objects)
|
|
317
|
-
*/
|
|
318
417
|
exports.browser = require('./src/browserApi');
|
|
319
418
|
</code></pre>
|
|
320
419
|
</article>
|
|
@@ -323,19 +422,26 @@ exports.browser = require('./src/browserApi');
|
|
|
323
422
|
|
|
324
423
|
|
|
325
424
|
|
|
326
|
-
</div>
|
|
327
|
-
|
|
328
|
-
<
|
|
329
|
-
|
|
330
|
-
</
|
|
331
|
-
|
|
332
|
-
<
|
|
425
|
+
</div>
|
|
426
|
+
|
|
427
|
+
<footer class="footer">
|
|
428
|
+
<div class="content has-text-centered">
|
|
429
|
+
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a></p>
|
|
430
|
+
<p class="sidebar-created-by">
|
|
431
|
+
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
|
|
432
|
+
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
|
|
433
|
+
</p>
|
|
434
|
+
</div>
|
|
435
|
+
</footer>
|
|
436
|
+
|
|
437
|
+
</div>
|
|
438
|
+
<div id="side-nav" class="side-nav">
|
|
439
|
+
</div>
|
|
440
|
+
</div>
|
|
441
|
+
<script src="scripts/app.min.js"></script>
|
|
442
|
+
<script>PR.prettyPrint();</script>
|
|
443
|
+
<script src="scripts/linenumber.js"> </script>
|
|
333
444
|
|
|
334
|
-
<footer>
|
|
335
|
-
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)
|
|
336
|
-
</footer>
|
|
337
445
|
|
|
338
|
-
<script> prettyPrint(); </script>
|
|
339
|
-
<script src="scripts/linenumber.js"> </script>
|
|
340
446
|
</body>
|
|
341
447
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";$().ready(function(){});var sidebarIsVisible=!1,toggleSidebar=function(e){var a=!(0<arguments.length&&void 0!==e)||e;$("#sidebarNav").toggleClass("sticky",a),$("#stickyNavbarOverlay").toggleClass("active",a),$("#hamburger").toggleClass("is-active"),sidebarIsVisible=a};$().ready(function(){$("#hamburger").click(function(){toggleSidebar(!sidebarIsVisible)}),$("#stickyNavbarOverlay").click(function(){sidebarIsVisible&&toggleSidebar(!1)})});var OFFSET=150;$().ready(function(){var o=$("#side-nav"),c=[];if($(".vertical-section").length||o.hide(),$(".vertical-section").each(function(e,a){var i=$(a),t=i.find("> h1").text();if(t){o.append($("<h3/>").text(t));var s=$("<ul></ul>");i.find(".members h4.name").each(function(e,a){var i=$(a),t=i.find(".code-name").clone().children().remove().end().text(),n=i.find("a").attr("href"),r=$('<a href="'.concat(n,'" />')).text(t);s.append($("<li></li>").append(r)),c.push({link:r,offset:i.offset().top})}),o.append(s)}else i.find(".members h4.name").each(function(e,a){var i=$(a),t=i.find(".code-name").clone().children().remove().end().text(),n=i.find("a").attr("href"),r=$('<a href="'.concat(n,'" />')).text(t);o.append(r),c.push({link:r,offset:i.offset().top})})}),!$.trim(o.text()))return o.hide();function e(){for(var e=n.scrollTop(),a=!1,i=c.length-1;0<=i;i--){var t=c[i];t.link.removeClass("is-active"),e+OFFSET>=t.offset?a?t.link.addClass("is-past"):(t.link.addClass("is-active"),a=!0):t.link.removeClass("is-past")}}var n=$("#main-content-wrapper");n.on("scroll",e),e(),c.forEach(function(e){e.link.click(function(){n.animate({scrollTop:e.offset-OFFSET+1},500)})})}),$().ready(function(){$("#sidebarNav a").each(function(e,a){var i=$(a).attr("href");window.location.pathname.match("/"+i)&&($(a).addClass("active"),$("#sidebarNav").scrollTop($(a).offset().top-150))})});
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*global document */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
(function() {
|
|
4
|
+
var source = document.getElementsByClassName('prettyprint source linenums');
|
|
5
|
+
var i = 0;
|
|
6
|
+
var lineNumber = 0;
|
|
7
|
+
var lineId;
|
|
8
|
+
var lines;
|
|
9
|
+
var totalLines;
|
|
10
|
+
var anchorHash;
|
|
10
11
|
|
|
11
12
|
if (source && source[0]) {
|
|
12
13
|
anchorHash = document.location.hash.substring(1);
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
|
|
16
17
|
for (; i < totalLines; i++) {
|
|
17
18
|
lineNumber++;
|
|
18
|
-
lineId =
|
|
19
|
+
lineId = 'line' + lineNumber;
|
|
19
20
|
lines[i].id = lineId;
|
|
20
21
|
if (lineId === anchorHash) {
|
|
21
22
|
lines[i].className += ' selected';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
const input = document.querySelector('#search')
|
|
3
|
+
const targets = [ ...document.querySelectorAll('#sidebarNav li')]
|
|
4
|
+
input.addEventListener('keyup', () => {
|
|
5
|
+
// loop over each targets and hide the not corresponding ones
|
|
6
|
+
targets.forEach(target => {
|
|
7
|
+
if (!target.innerText.toLowerCase().includes(input.value.toLowerCase())) {
|
|
8
|
+
target.style.display = 'none'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Detects an empty list
|
|
12
|
+
* Remove the list and the list's title if the list is not displayed
|
|
13
|
+
*/
|
|
14
|
+
const list = [...target.parentNode.childNodes].filter( elem => elem.style.display !== 'none')
|
|
15
|
+
|
|
16
|
+
if (!list.length) {
|
|
17
|
+
target.parentNode.style.display = 'none'
|
|
18
|
+
target.parentNode.previousSibling.style.display = 'none'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Detects empty category
|
|
23
|
+
* Remove the entire category if no item is displayed
|
|
24
|
+
*/
|
|
25
|
+
const category = [...target.parentNode.parentNode.childNodes]
|
|
26
|
+
.filter( elem => elem.tagName !== 'H2' && elem.style.display !== 'none')
|
|
27
|
+
|
|
28
|
+
if (!category.length) {
|
|
29
|
+
target.parentNode.parentNode.style.display = 'none'
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
target.parentNode.style.display = 'block'
|
|
33
|
+
target.parentNode.previousSibling.style.display = 'block'
|
|
34
|
+
target.parentNode.parentNode.style.display = 'block'
|
|
35
|
+
target.style.display = 'block'
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
})()
|