w-data-csv 1.0.1 → 1.0.3
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/.eslintrc.js +17 -17
- package/.github/workflows/ci-test.yml +24 -0
- package/babel.config.js +1 -0
- package/dist/w-data-csv.umd.js +2 -2
- package/dist/w-data-csv.umd.js.map +1 -1
- package/docs/WDataCsv.mjs.html +5 -2
- package/docs/global.html +38 -23
- package/docs/index.html +5 -2
- package/docs/scripts/collapse.js +19 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/search.js +16 -0
- package/docs/styles/jsdoc.css +13 -2
- package/docs/styles/prettify.css +1 -0
- package/package.json +3 -3
- package/test/all.test.mjs +10 -0
- package/test/PCA.test.mjs +0 -125
- package/test/cluster.test.mjs +0 -135
package/docs/global.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WDataCsv">WDataCsv</a></li><li><a href="global.html#readCsv">readCsv</a></li><li><a href="global.html#writeCsv">writeCsv</a></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -46,6 +49,8 @@
|
|
|
46
49
|
|
|
47
50
|
<h2>
|
|
48
51
|
|
|
52
|
+
|
|
53
|
+
|
|
49
54
|
</h2>
|
|
50
55
|
|
|
51
56
|
|
|
@@ -58,6 +63,7 @@
|
|
|
58
63
|
|
|
59
64
|
|
|
60
65
|
<dl class="details">
|
|
66
|
+
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
|
|
@@ -126,6 +132,10 @@
|
|
|
126
132
|
|
|
127
133
|
|
|
128
134
|
<dl class="details">
|
|
135
|
+
|
|
136
|
+
<dt class="tag-description">Description:</dt>
|
|
137
|
+
<dd class="tag-description"><ul class="dummy"><li><p>讀寫CSV檔</p></li></ul></dd>
|
|
138
|
+
|
|
129
139
|
|
|
130
140
|
|
|
131
141
|
<dt class="tag-source">Source:</dt>
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
|
|
180
190
|
|
|
181
191
|
|
|
182
|
-
<h5>Example</h5>
|
|
192
|
+
<h5 class="h5-examples">Example</h5>
|
|
183
193
|
|
|
184
194
|
<pre class="prettyprint"><code>import wdc from './src/WDataCsv.mjs'
|
|
185
195
|
.then((ltdtIn) => {
|
|
186
196
|
console.log(ltdtIn)
|
|
187
197
|
// => [ { NAME: 'Daffy Duck', AGE: '24' }, { NAME: 'Bugs 邦妮', AGE: '22' } ]
|
|
188
198
|
})
|
|
189
199
|
.catch((err) => {
|
|
190
200
|
console.log(err)
|
|
191
201
|
})
|
|
192
202
|
.then((res) => {
|
|
193
203
|
console.log(res)
|
|
194
204
|
// => finish
|
|
195
205
|
})
|
|
196
206
|
.catch((err) => {
|
|
197
207
|
console.log(err)
|
|
198
208
|
})</code></pre>
|
|
199
209
|
|
|
@@ -196,7 +206,7 @@
|
|
|
196
206
|
|
|
197
207
|
|
|
198
208
|
|
|
199
|
-
<h4 class="name" id="readCsv"><span class="type-signature">(async) </span>readCsv<span class="signature">(fp)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
209
|
+
<h4 class="name" id="readCsv"><span class="type-signature type-signature-async">(async) </span>readCsv<span class="signature">(fp)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
200
210
|
|
|
201
211
|
|
|
202
212
|
|
|
@@ -204,6 +214,10 @@
|
|
|
204
214
|
|
|
205
215
|
|
|
206
216
|
<dl class="details">
|
|
217
|
+
|
|
218
|
+
<dt class="tag-description">Description:</dt>
|
|
219
|
+
<dd class="tag-description"><ul class="dummy"><li><p>讀取CSV檔,自動清除BOM</p></li></ul></dd>
|
|
220
|
+
|
|
207
221
|
|
|
208
222
|
|
|
209
223
|
<dt class="tag-source">Source:</dt>
|
|
@@ -247,26 +261,20 @@
|
|
|
247
261
|
|
|
248
262
|
|
|
249
263
|
|
|
250
|
-
<div class="description usertext">
|
|
251
|
-
<p>讀取CSV檔,自動清除BOM</p>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
|
|
255
264
|
|
|
256
265
|
|
|
257
266
|
|
|
258
267
|
|
|
259
268
|
|
|
260
269
|
|
|
261
|
-
|
|
262
|
-
<h5>Example</h5>
|
|
270
|
+
<h5 class="h5-examples">Example</h5>
|
|
263
271
|
|
|
264
272
|
<pre class="prettyprint"><code>import wdc from './src/WDataCsv.mjs'
|
|
265
273
|
.then((ltdt) => {
|
|
266
274
|
console.log(ltdt)
|
|
267
275
|
// => [ { NAME: 'Daffy Duck', AGE: '24' }, { NAME: 'Bugs 邦妮', AGE: '22' } ]
|
|
268
276
|
})
|
|
269
277
|
.catch((err) => {
|
|
270
278
|
console.log(err)
|
|
271
279
|
})</code></pre>
|
|
272
280
|
|
|
273
281
|
|
|
274
282
|
|
|
275
283
|
|
|
276
|
-
<h5>Parameters:</h5>
|
|
284
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
277
285
|
|
|
278
286
|
|
|
279
287
|
<table class="params">
|
|
@@ -300,6 +308,7 @@
|
|
|
300
308
|
<span class="param-type">String</span>
|
|
301
309
|
|
|
302
310
|
|
|
311
|
+
|
|
303
312
|
|
|
304
313
|
</td>
|
|
305
314
|
|
|
@@ -329,7 +338,7 @@
|
|
|
329
338
|
|
|
330
339
|
|
|
331
340
|
|
|
332
|
-
<h5>Returns:</h5>
|
|
341
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
333
342
|
|
|
334
343
|
|
|
335
344
|
<div class="param-desc">
|
|
@@ -347,6 +356,7 @@
|
|
|
347
356
|
<span class="param-type">Promise</span>
|
|
348
357
|
|
|
349
358
|
|
|
359
|
+
|
|
350
360
|
</dd>
|
|
351
361
|
</dl>
|
|
352
362
|
|
|
@@ -359,7 +369,7 @@
|
|
|
359
369
|
|
|
360
370
|
|
|
361
371
|
|
|
362
|
-
<h4 class="name" id="writeCsv"><span class="type-signature">(async) </span>writeCsv<span class="signature">(fp, data, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
372
|
+
<h4 class="name" id="writeCsv"><span class="type-signature type-signature-async">(async) </span>writeCsv<span class="signature">(fp, data, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
363
373
|
|
|
364
374
|
|
|
365
375
|
|
|
@@ -367,6 +377,10 @@
|
|
|
367
377
|
|
|
368
378
|
|
|
369
379
|
<dl class="details">
|
|
380
|
+
|
|
381
|
+
<dt class="tag-description">Description:</dt>
|
|
382
|
+
<dd class="tag-description"><ul class="dummy"><li><p>輸出數據至CSV檔案</p></li></ul></dd>
|
|
383
|
+
|
|
370
384
|
|
|
371
385
|
|
|
372
386
|
<dt class="tag-source">Source:</dt>
|
|
@@ -410,26 +424,20 @@
|
|
|
410
424
|
|
|
411
425
|
|
|
412
426
|
|
|
413
|
-
<div class="description usertext">
|
|
414
|
-
<p>輸出數據至CSV檔案</p>
|
|
415
|
-
</div>
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
427
|
|
|
420
428
|
|
|
421
429
|
|
|
422
430
|
|
|
423
431
|
|
|
424
432
|
|
|
425
|
-
<h5>Example</h5>
|
|
433
|
+
<h5 class="h5-examples">Example</h5>
|
|
426
434
|
|
|
427
435
|
<pre class="prettyprint"><code>import wdc from './src/WDataCsv.mjs'
|
|
428
436
|
.then((res) => {
|
|
429
437
|
console.log(res)
|
|
430
438
|
// => finish
|
|
431
439
|
})
|
|
432
440
|
.catch((err) => {
|
|
433
441
|
console.log(err)
|
|
434
442
|
})</code></pre>
|
|
435
443
|
|
|
436
444
|
|
|
437
445
|
|
|
438
446
|
|
|
439
|
-
<h5>Parameters:</h5>
|
|
447
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
440
448
|
|
|
441
449
|
|
|
442
450
|
<table class="params">
|
|
@@ -467,6 +475,7 @@
|
|
|
467
475
|
<span class="param-type">String</span>
|
|
468
476
|
|
|
469
477
|
|
|
478
|
+
|
|
470
479
|
|
|
471
480
|
</td>
|
|
472
481
|
|
|
@@ -502,6 +511,7 @@
|
|
|
502
511
|
<span class="param-type">Array</span>
|
|
503
512
|
|
|
504
513
|
|
|
514
|
+
|
|
505
515
|
|
|
506
516
|
</td>
|
|
507
517
|
|
|
@@ -537,6 +547,7 @@
|
|
|
537
547
|
<span class="param-type">Object</span>
|
|
538
548
|
|
|
539
549
|
|
|
550
|
+
|
|
540
551
|
|
|
541
552
|
</td>
|
|
542
553
|
|
|
@@ -599,6 +610,7 @@
|
|
|
599
610
|
<span class="param-type">String</span>
|
|
600
611
|
|
|
601
612
|
|
|
613
|
+
|
|
602
614
|
|
|
603
615
|
</td>
|
|
604
616
|
|
|
@@ -638,6 +650,7 @@
|
|
|
638
650
|
<span class="param-type">Array</span>
|
|
639
651
|
|
|
640
652
|
|
|
653
|
+
|
|
641
654
|
|
|
642
655
|
</td>
|
|
643
656
|
|
|
@@ -677,6 +690,7 @@
|
|
|
677
690
|
<span class="param-type">Object</span>
|
|
678
691
|
|
|
679
692
|
|
|
693
|
+
|
|
680
694
|
|
|
681
695
|
</td>
|
|
682
696
|
|
|
@@ -729,7 +743,7 @@
|
|
|
729
743
|
|
|
730
744
|
|
|
731
745
|
|
|
732
|
-
<h5>Returns:</h5>
|
|
746
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
733
747
|
|
|
734
748
|
|
|
735
749
|
<div class="param-desc">
|
|
@@ -747,6 +761,7 @@
|
|
|
747
761
|
<span class="param-type">Promise</span>
|
|
748
762
|
|
|
749
763
|
|
|
764
|
+
|
|
750
765
|
</dd>
|
|
751
766
|
</dl>
|
|
752
767
|
|
|
@@ -774,7 +789,7 @@
|
|
|
774
789
|
<br class="clear">
|
|
775
790
|
|
|
776
791
|
<footer>
|
|
777
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
792
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Thu Mar 30 2023 20:25:45 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
778
793
|
</footer>
|
|
779
794
|
|
|
780
795
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
15
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
16
|
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
|
|
17
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
19
|
</head>
|
|
19
20
|
<body>
|
|
@@ -27,7 +28,9 @@
|
|
|
27
28
|
|
|
28
29
|
<nav >
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WDataCsv">WDataCsv</a></li><li><a href="global.html#readCsv">readCsv</a></li><li><a href="global.html#writeCsv">writeCsv</a></li></ul>
|
|
33
|
+
|
|
31
34
|
</nav>
|
|
32
35
|
|
|
33
36
|
<div id="main">
|
|
@@ -68,7 +71,7 @@
|
|
|
68
71
|
<br class="clear">
|
|
69
72
|
|
|
70
73
|
<footer>
|
|
71
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Thu Mar 30 2023 20:25:45 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
72
75
|
</footer>
|
|
73
76
|
|
|
74
77
|
<script>prettyPrint();</script>
|
package/docs/scripts/collapse.js
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
function hideAllButCurrent(){
|
|
2
2
|
//by default all submenut items are hidden
|
|
3
3
|
//but we need to rehide them for search
|
|
4
|
+
document.querySelectorAll("nav > ul").forEach(function(parent) {
|
|
5
|
+
if (parent.className.indexOf("collapse_top") !== -1) {
|
|
6
|
+
parent.style.display = "none";
|
|
7
|
+
}
|
|
8
|
+
});
|
|
4
9
|
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) {
|
|
5
10
|
parent.style.display = "none";
|
|
6
11
|
});
|
|
12
|
+
document.querySelectorAll("nav > h3").forEach(function(section) {
|
|
13
|
+
if (section.className.indexOf("collapsed_header") !== -1) {
|
|
14
|
+
section.addEventListener("click", function(){
|
|
15
|
+
if (section.nextSibling.style.display === "none") {
|
|
16
|
+
section.nextSibling.style.display = "block";
|
|
17
|
+
} else {
|
|
18
|
+
section.nextSibling.style.display = "none";
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
7
23
|
|
|
8
24
|
//only current page (if it exists) should be opened
|
|
9
25
|
var file = window.location.pathname.split("/").pop().replace(/\.html/, '');
|
|
10
26
|
document.querySelectorAll("nav > ul > li > a").forEach(function(parent) {
|
|
11
27
|
var href = parent.attributes.href.value.replace(/\.html/, '');
|
|
12
28
|
if (file === href) {
|
|
29
|
+
if (parent.parentNode.parentNode.className.indexOf("collapse_top") !== -1) {
|
|
30
|
+
parent.parentNode.parentNode.style.display = "block";
|
|
31
|
+
}
|
|
13
32
|
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) {
|
|
14
33
|
elem.style.display = "block";
|
|
15
34
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
if (typeof fetch === 'function') {
|
|
2
|
+
const init = () => {
|
|
3
|
+
if (typeof scrollToNavItem !== 'function') return false
|
|
4
|
+
scrollToNavItem()
|
|
5
|
+
// hideAllButCurrent not always loaded
|
|
6
|
+
if (typeof hideAllButCurrent === 'function') hideAllButCurrent()
|
|
7
|
+
return true
|
|
8
|
+
}
|
|
9
|
+
fetch('./nav.inc.html')
|
|
10
|
+
.then(response => response.ok ? response.text() : `${response.url} => ${response.status} ${response.statusText}`)
|
|
11
|
+
.then(body => {
|
|
12
|
+
document.querySelector('nav').innerHTML += body
|
|
13
|
+
// nav.js should be quicker to load than nav.inc.html, a fallback just in case
|
|
14
|
+
return init()
|
|
15
|
+
})
|
|
16
|
+
.then(done => {
|
|
17
|
+
if (done) return
|
|
18
|
+
let i = 0
|
|
19
|
+
;(function waitUntilNavJs () {
|
|
20
|
+
if (init()) return
|
|
21
|
+
if (i++ < 100) return setTimeout(waitUntilNavJs, 300)
|
|
22
|
+
console.error(Error('nav.js not loaded after 30s waiting for it'))
|
|
23
|
+
})()
|
|
24
|
+
})
|
|
25
|
+
.catch(error => console.error(error))
|
|
26
|
+
} else {
|
|
27
|
+
console.error(Error('Browser too old to display commonNav (remove commonNav docdash option)'))
|
|
28
|
+
}
|
package/docs/scripts/search.js
CHANGED
|
@@ -33,6 +33,9 @@ document.getElementById("nav-search").addEventListener("keyup", function(event)
|
|
|
33
33
|
document.querySelectorAll("nav > ul > li").forEach(function(elem) {
|
|
34
34
|
elem.style.display = "block";
|
|
35
35
|
});
|
|
36
|
+
document.querySelectorAll("nav > ul").forEach(function(elem) {
|
|
37
|
+
elem.style.display = "block";
|
|
38
|
+
});
|
|
36
39
|
//hide all results
|
|
37
40
|
document.querySelectorAll("nav > ul > li > ul li").forEach(function(elem) {
|
|
38
41
|
elem.style.display = "none";
|
|
@@ -79,5 +82,18 @@ document.getElementById("nav-search").addEventListener("keyup", function(event)
|
|
|
79
82
|
parent.style.display = "none";
|
|
80
83
|
}
|
|
81
84
|
});
|
|
85
|
+
document.querySelectorAll("nav > ul.collapse_top").forEach(function(parent) {
|
|
86
|
+
var countVisible = 0;
|
|
87
|
+
parent.querySelectorAll("li").forEach(function(elem) {
|
|
88
|
+
if (elem.style.display !== "none") {
|
|
89
|
+
countVisible++;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (countVisible == 0) {
|
|
94
|
+
//has no child at all and does not contain text
|
|
95
|
+
parent.style.display = "none";
|
|
96
|
+
}
|
|
97
|
+
});
|
|
82
98
|
}
|
|
83
99
|
});
|
package/docs/styles/jsdoc.css
CHANGED
|
@@ -162,12 +162,19 @@ h6 {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
|
|
165
|
-
tt, code, kbd, samp {
|
|
165
|
+
tt, code, kbd, samp, pre {
|
|
166
166
|
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
|
167
167
|
background: #f4f4f4;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
tt, code, kbd, samp{
|
|
168
171
|
padding: 1px 5px;
|
|
169
172
|
}
|
|
170
173
|
|
|
174
|
+
pre {
|
|
175
|
+
padding-bottom: 1em;
|
|
176
|
+
}
|
|
177
|
+
|
|
171
178
|
.class-description {
|
|
172
179
|
font-size: 130%;
|
|
173
180
|
line-height: 140%;
|
|
@@ -242,6 +249,10 @@ nav h3 {
|
|
|
242
249
|
color: #000;
|
|
243
250
|
}
|
|
244
251
|
|
|
252
|
+
nav h3.collapsed_header {
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
}
|
|
255
|
+
|
|
245
256
|
nav ul {
|
|
246
257
|
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
|
|
247
258
|
font-size: 100%;
|
|
@@ -762,4 +773,4 @@ html[data-search-mode] .level-hide {
|
|
|
762
773
|
font-weight: 300;
|
|
763
774
|
font-style: normal;
|
|
764
775
|
|
|
765
|
-
}
|
|
776
|
+
}
|
package/docs/styles/prettify.css
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w-data-csv",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "dist/w-data-csv.umd.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"csv-parser": "^3.0.0",
|
|
7
7
|
"lodash": "^4.17.21",
|
|
8
8
|
"strip-bom-stream": "^5.0.0",
|
|
9
|
-
"wsemi": "^1.
|
|
9
|
+
"wsemi": "^1.7.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"w-package-tools": "^1.0.
|
|
12
|
+
"w-package-tools": "^1.0.69"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"test": "mocha --parallel --timeout 60000 --experimental-modules --es-module-specifier-resolution=node",
|
package/test/PCA.test.mjs
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
2
|
-
import WDataCsv from '../src/WDataCsv.mjs'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe(`PCA`, function() {
|
|
6
|
-
|
|
7
|
-
let mat = [
|
|
8
|
-
[40, 50, 60],
|
|
9
|
-
[50, 70, 60],
|
|
10
|
-
[80, 70, 90],
|
|
11
|
-
[50, 60, 80]
|
|
12
|
-
]
|
|
13
|
-
let clmat = [
|
|
14
|
-
[36.76572825085965, 50.81184119955175, 61.992939427698765],
|
|
15
|
-
[50.520478881706346, 69.86935352609807, 59.679283942385844],
|
|
16
|
-
[77.39502404588043, 70.65388036857387, 91.60517102143689],
|
|
17
|
-
[55.318768821553576, 58.66492490577632, 76.7226056084785]
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
it(`should return '${JSON.stringify(clmat)}' when input ${JSON.stringify(mat)}, { nCompNIPALS: 2 }`, async function() {
|
|
21
|
-
let r = await WDataCsv.PCA(mat, { nCompNIPALS: 2 })
|
|
22
|
-
assert.strict.deepStrictEqual(r, clmat)
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it(`should return 'Error: data is not eff. array' when input 123`, async function() {
|
|
26
|
-
let r = ''
|
|
27
|
-
await WDataCsv.PCA(123)
|
|
28
|
-
.catch((err) => {
|
|
29
|
-
r = err.toString()
|
|
30
|
-
})
|
|
31
|
-
let rr = 'Error: data is not eff. array'
|
|
32
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it(`should return 'Error: data is not eff. array' when input 123.456`, async function() {
|
|
36
|
-
let r = ''
|
|
37
|
-
await WDataCsv.PCA(123.456)
|
|
38
|
-
.catch((err) => {
|
|
39
|
-
r = err.toString()
|
|
40
|
-
})
|
|
41
|
-
let rr = 'Error: data is not eff. array'
|
|
42
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it(`should return 'Error: data is not eff. array' when input '123'`, async function() {
|
|
46
|
-
let r = ''
|
|
47
|
-
await WDataCsv.PCA('123')
|
|
48
|
-
.catch((err) => {
|
|
49
|
-
r = err.toString()
|
|
50
|
-
})
|
|
51
|
-
let rr = 'Error: data is not eff. array'
|
|
52
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it(`should return 'Error: data is not eff. array' when input '123.456'`, async function() {
|
|
56
|
-
let r = ''
|
|
57
|
-
await WDataCsv.PCA('123.456')
|
|
58
|
-
.catch((err) => {
|
|
59
|
-
r = err.toString()
|
|
60
|
-
})
|
|
61
|
-
let rr = 'Error: data is not eff. array'
|
|
62
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it(`should return 'Error: data is not eff. array' when input true`, async function() {
|
|
66
|
-
let r = ''
|
|
67
|
-
await WDataCsv.PCA(true)
|
|
68
|
-
.catch((err) => {
|
|
69
|
-
r = err.toString()
|
|
70
|
-
})
|
|
71
|
-
let rr = 'Error: data is not eff. array'
|
|
72
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it(`should return 'Error: data is not eff. array' when input ''`, async function() {
|
|
76
|
-
let r = ''
|
|
77
|
-
await WDataCsv.PCA('')
|
|
78
|
-
.catch((err) => {
|
|
79
|
-
r = err.toString()
|
|
80
|
-
})
|
|
81
|
-
let rr = 'Error: data is not eff. array'
|
|
82
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it(`should return 'Error: data is not eff. array' when input []`, async function() {
|
|
86
|
-
let r = ''
|
|
87
|
-
await WDataCsv.PCA([])
|
|
88
|
-
.catch((err) => {
|
|
89
|
-
r = err.toString()
|
|
90
|
-
})
|
|
91
|
-
let rr = 'Error: data is not eff. array'
|
|
92
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
it(`should return 'Error: data is not eff. array' when input {}`, async function() {
|
|
96
|
-
let r = ''
|
|
97
|
-
await WDataCsv.PCA({})
|
|
98
|
-
.catch((err) => {
|
|
99
|
-
r = err.toString()
|
|
100
|
-
})
|
|
101
|
-
let rr = 'Error: data is not eff. array'
|
|
102
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it(`should return 'Error: data is not eff. array' when input null`, async function() {
|
|
106
|
-
let r = ''
|
|
107
|
-
await WDataCsv.PCA(null)
|
|
108
|
-
.catch((err) => {
|
|
109
|
-
r = err.toString()
|
|
110
|
-
})
|
|
111
|
-
let rr = 'Error: data is not eff. array'
|
|
112
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it(`should return 'Error: data is not eff. array' when input undefined`, async function() {
|
|
116
|
-
let r = ''
|
|
117
|
-
await WDataCsv.PCA(undefined)
|
|
118
|
-
.catch((err) => {
|
|
119
|
-
r = err.toString()
|
|
120
|
-
})
|
|
121
|
-
let rr = 'Error: data is not eff. array'
|
|
122
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
})
|