w-data-csv 1.0.2 → 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/.github/workflows/ci-test.yml +24 -0
- package/dist/w-data-csv.umd.js +1 -1
- package/docs/WDataCsv.mjs.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- 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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
strategy:
|
|
11
|
+
matrix:
|
|
12
|
+
node-version: [18.x]
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v2
|
|
16
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
+
uses: actions/setup-node@v1
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
- run: npm cache clean -f
|
|
21
|
+
- run: npm install
|
|
22
|
+
- run: npm test
|
|
23
|
+
env:
|
|
24
|
+
CI: true
|
package/dist/w-data-csv.umd.js
CHANGED
package/docs/WDataCsv.mjs.html
CHANGED
|
@@ -232,7 +232,7 @@ export default WDataCsv
|
|
|
232
232
|
<br class="clear">
|
|
233
233
|
|
|
234
234
|
<footer>
|
|
235
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
235
|
+
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.
|
|
236
236
|
</footer>
|
|
237
237
|
|
|
238
238
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -789,7 +789,7 @@
|
|
|
789
789
|
<br class="clear">
|
|
790
790
|
|
|
791
791
|
<footer>
|
|
792
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
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.
|
|
793
793
|
</footer>
|
|
794
794
|
|
|
795
795
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on
|
|
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.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
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.7.
|
|
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
|
-
})
|
package/test/cluster.test.mjs
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
2
|
-
import WDataCsv from '../src/WDataCsv.mjs'
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
describe(`cluster`, function() {
|
|
6
|
-
|
|
7
|
-
let mode = 'k-medoids'
|
|
8
|
-
|
|
9
|
-
let mat = [
|
|
10
|
-
[40, 50, 60],
|
|
11
|
-
[50, 70, 60],
|
|
12
|
-
[80, 70, 90],
|
|
13
|
-
[50, 60, 80]
|
|
14
|
-
]
|
|
15
|
-
let clmat = { 'keys': null, 'ginds': [[2], [0, 1, 3]], 'gltdt': [[[80, 70, 90]], [[40, 50, 60], [50, 70, 60], [50, 60, 80]]], 'gmat': [[[77.39502404588043, 70.65388036857387, 91.60517102143689]], [[36.76572825085965, 50.81184119955175, 61.992939427698765], [50.520478881706346, 69.86935352609807, 59.679283942385844], [55.318768821553576, 58.66492490577632, 76.7226056084785]]] }
|
|
16
|
-
|
|
17
|
-
it(`should return '${JSON.stringify(clmat)}' when input ${JSON.stringify(mat)}, { mode, kNumber: 2, nCompNIPALS: 2 }`, async function() {
|
|
18
|
-
let r = await WDataCsv.cluster(mat, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
19
|
-
assert.strict.deepStrictEqual(r, clmat)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
let ltdt = [
|
|
23
|
-
{ name: 'Cameron', a: 40, b: 50, c: 60 },
|
|
24
|
-
{ name: 'Buckley', a: 50, b: 70, c: 60 },
|
|
25
|
-
{ name: 'Paul', a: 80, b: 70, c: 90 },
|
|
26
|
-
{ name: 'Fawcett', a: 50, b: 60, c: 80 },
|
|
27
|
-
]
|
|
28
|
-
let clltdt = { 'keys': ['a', 'b', 'c'], 'ginds': [[2], [0, 1, 3]], 'gltdt': [[{ 'name': 'Paul', 'a': 80, 'b': 70, 'c': 90 }], [{ 'name': 'Cameron', 'a': 40, 'b': 50, 'c': 60 }, { 'name': 'Buckley', 'a': 50, 'b': 70, 'c': 60 }, { 'name': 'Fawcett', 'a': 50, 'b': 60, 'c': 80 }]], 'gmat': [[[77.39502404588043, 70.65388036857387, 91.60517102143689]], [[36.76572825085965, 50.81184119955175, 61.992939427698765], [50.520478881706346, 69.86935352609807, 59.679283942385844], [55.318768821553576, 58.66492490577632, 76.7226056084785]]] }
|
|
29
|
-
|
|
30
|
-
it(`should return '${JSON.stringify(clltdt)}' when input ${JSON.stringify(ltdt)}, { mode, kNumber: 2, nCompNIPALS: 2 }`, async function() {
|
|
31
|
-
let r = await WDataCsv.cluster(ltdt, { mode, kNumber: 2, nCompNIPALS: 2 })
|
|
32
|
-
assert.strict.deepStrictEqual(r, clltdt)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
it(`should return 'Error: data is not eff. array' when input 123`, async function() {
|
|
36
|
-
let r = ''
|
|
37
|
-
await WDataCsv.cluster(123)
|
|
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.456`, async function() {
|
|
46
|
-
let r = ''
|
|
47
|
-
await WDataCsv.cluster(123.456)
|
|
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'`, async function() {
|
|
56
|
-
let r = ''
|
|
57
|
-
await WDataCsv.cluster('123')
|
|
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 '123.456'`, async function() {
|
|
66
|
-
let r = ''
|
|
67
|
-
await WDataCsv.cluster('123.456')
|
|
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 true`, async function() {
|
|
76
|
-
let r = ''
|
|
77
|
-
await WDataCsv.cluster(true)
|
|
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.cluster('')
|
|
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.cluster([])
|
|
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 {}`, async function() {
|
|
106
|
-
let r = ''
|
|
107
|
-
await WDataCsv.cluster({})
|
|
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 null`, async function() {
|
|
116
|
-
let r = ''
|
|
117
|
-
await WDataCsv.cluster(null)
|
|
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
|
-
it(`should return 'Error: data is not eff. array' when input undefined`, async function() {
|
|
126
|
-
let r = ''
|
|
127
|
-
await WDataCsv.cluster(undefined)
|
|
128
|
-
.catch((err) => {
|
|
129
|
-
r = err.toString()
|
|
130
|
-
})
|
|
131
|
-
let rr = 'Error: data is not eff. array'
|
|
132
|
-
assert.strict.deepStrictEqual(r, rr)
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
})
|