w-dwdata-tweq 1.0.0 → 1.0.2
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/dist/w-dwdata-tweq.umd.js +3 -3
- package/dist/w-dwdata-tweq.umd.js.map +1 -1
- package/docs/WDwdataTweq.mjs.html +17 -3
- package/docs/global.html +3 -3
- package/docs/index.html +1 -1
- package/g.mjs +2 -1
- package/package.json +3 -3
- package/src/WDwdataTweq.mjs +16 -2
- package/src/parseData.mjs +2 -2
- package/test/WDwdataTweq.test.mjs +1 -1
|
@@ -50,7 +50,9 @@ import get from 'lodash-es/get.js'
|
|
|
50
50
|
import each from 'lodash-es/each.js'
|
|
51
51
|
import reverse from 'lodash-es/reverse.js'
|
|
52
52
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
53
|
+
import isnum from 'wsemi/src/isnum.mjs'
|
|
53
54
|
import isfun from 'wsemi/src/isfun.mjs'
|
|
55
|
+
import cint from 'wsemi/src/cint.mjs'
|
|
54
56
|
import fsIsFolder from 'wsemi/src/fsIsFolder.mjs'
|
|
55
57
|
import fsCleanFolder from 'wsemi/src/fsCleanFolder.mjs'
|
|
56
58
|
import fsCreateFolder from 'wsemi/src/fsCreateFolder.mjs'
|
|
@@ -72,7 +74,7 @@ import cropPic from './cropPic.mjs'
|
|
|
72
74
|
* @param {String} [opt.keyId] 輸入各筆數據之主鍵字串,預設keyId
|
|
73
75
|
* @param {String} [opt.fdDwAttime] 輸入當前下載數據資料夾字串,預設'./_dwAttime'
|
|
74
76
|
* @param {String} [opt.fdDwCurrent] 輸入已下載數據資料夾字串,預設'./_dwCurrent'
|
|
75
|
-
* @param {String} [opt.fdResult]
|
|
77
|
+
* @param {String} [opt.fdResult] 輸入已下載數據所連動生成數據資料夾字串,預設`./_result`
|
|
76
78
|
* @param {String} [opt.fdTaskCpSrc] 輸入任務狀態之來源端資料夾字串,預設'./_taskCpSrc'
|
|
77
79
|
* @param {Function} [opt.funDownload] 輸入自定義下載函數,回傳資料陣列
|
|
78
80
|
* @param {Function} [opt.funGetCurrent] 輸入自定義取得當前資料函數,回傳資料陣列
|
|
@@ -111,6 +113,18 @@ import cropPic from './cropPic.mjs'
|
|
|
111
113
|
*/
|
|
112
114
|
let WDwdataTweq = async(yearStart, yearEnd, opt = {}) => {
|
|
113
115
|
|
|
116
|
+
//check yearStart
|
|
117
|
+
if (!isnum(yearStart)) {
|
|
118
|
+
throw new Error(`yearStart is not a number`)
|
|
119
|
+
}
|
|
120
|
+
yearStart = cint(yearStart)
|
|
121
|
+
|
|
122
|
+
//check yearEnd
|
|
123
|
+
if (!isnum(yearEnd)) {
|
|
124
|
+
throw new Error(`yearEnd is not a number`)
|
|
125
|
+
}
|
|
126
|
+
yearEnd = cint(yearEnd)
|
|
127
|
+
|
|
114
128
|
//keyId
|
|
115
129
|
let keyId = get(opt, 'keyId')
|
|
116
130
|
if (!isestr(keyId)) {
|
|
@@ -138,7 +152,7 @@ let WDwdataTweq = async(yearStart, yearEnd, opt = {}) => {
|
|
|
138
152
|
//fdResult
|
|
139
153
|
let fdResult = get(opt, 'fdResult')
|
|
140
154
|
if (!isestr(fdResult)) {
|
|
141
|
-
fdResult =
|
|
155
|
+
fdResult = `./_result`
|
|
142
156
|
}
|
|
143
157
|
if (!fsIsFolder(fdResult)) {
|
|
144
158
|
fsCreateFolder(fdResult)
|
|
@@ -305,7 +319,7 @@ export default WDwdataTweq
|
|
|
305
319
|
<br class="clear">
|
|
306
320
|
|
|
307
321
|
<footer>
|
|
308
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on
|
|
322
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:30:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
309
323
|
</footer>
|
|
310
324
|
|
|
311
325
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
|
|
147
147
|
<dt class="tag-source">Source:</dt>
|
|
148
148
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
149
|
-
<a href="WDwdataTweq.mjs.html">WDwdataTweq.mjs</a>, <a href="WDwdataTweq.mjs.html#
|
|
149
|
+
<a href="WDwdataTweq.mjs.html">WDwdataTweq.mjs</a>, <a href="WDwdataTweq.mjs.html#line67">line 67</a>
|
|
150
150
|
</li></ul></dd>
|
|
151
151
|
|
|
152
152
|
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
|
|
490
490
|
|
|
491
491
|
|
|
492
|
-
<td class="description last"><p
|
|
492
|
+
<td class="description last"><p>輸入已下載數據所連動生成數據資料夾字串,預設<code>./_result</code></p></td>
|
|
493
493
|
</tr>
|
|
494
494
|
|
|
495
495
|
|
|
@@ -768,7 +768,7 @@
|
|
|
768
768
|
<br class="clear">
|
|
769
769
|
|
|
770
770
|
<footer>
|
|
771
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on
|
|
771
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:30:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
772
772
|
</footer>
|
|
773
773
|
|
|
774
774
|
<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.4</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> on Sun Aug 24 2025 23:30:15 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/g.mjs
CHANGED
|
@@ -14,7 +14,7 @@ let fdDwCurrent = `./_dwCurrent`
|
|
|
14
14
|
w.fsCleanFolder(fdDwCurrent)
|
|
15
15
|
|
|
16
16
|
//fdResult
|
|
17
|
-
let fdResult =
|
|
17
|
+
let fdResult = `./_result`
|
|
18
18
|
w.fsCleanFolder(fdResult)
|
|
19
19
|
|
|
20
20
|
let yearStart = 2022
|
|
@@ -50,4 +50,5 @@ ev.on('change', (msg) => {
|
|
|
50
50
|
// change { event: 'proc-add-callfun-add', id: '111002', msg: 'done' }
|
|
51
51
|
// ...
|
|
52
52
|
|
|
53
|
+
|
|
53
54
|
//node g.mjs
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w-dwdata-tweq",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/w-dwdata-tweq.umd.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"axios": "^1.11.0",
|
|
7
7
|
"lodash-es": "^4.17.21",
|
|
8
8
|
"sharp": "^0.34.3",
|
|
9
|
-
"w-dwdata-builder": "^1.0.
|
|
9
|
+
"w-dwdata-builder": "^1.0.2",
|
|
10
10
|
"wsemi": "^1.8.18"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
],
|
|
32
32
|
"author": "yuda-lyu(semisphere)",
|
|
33
33
|
"license": "MIT"
|
|
34
|
-
}
|
|
34
|
+
}
|
package/src/WDwdataTweq.mjs
CHANGED
|
@@ -3,7 +3,9 @@ import get from 'lodash-es/get.js'
|
|
|
3
3
|
import each from 'lodash-es/each.js'
|
|
4
4
|
import reverse from 'lodash-es/reverse.js'
|
|
5
5
|
import isestr from 'wsemi/src/isestr.mjs'
|
|
6
|
+
import isnum from 'wsemi/src/isnum.mjs'
|
|
6
7
|
import isfun from 'wsemi/src/isfun.mjs'
|
|
8
|
+
import cint from 'wsemi/src/cint.mjs'
|
|
7
9
|
import fsIsFolder from 'wsemi/src/fsIsFolder.mjs'
|
|
8
10
|
import fsCleanFolder from 'wsemi/src/fsCleanFolder.mjs'
|
|
9
11
|
import fsCreateFolder from 'wsemi/src/fsCreateFolder.mjs'
|
|
@@ -25,7 +27,7 @@ import cropPic from './cropPic.mjs'
|
|
|
25
27
|
* @param {String} [opt.keyId] 輸入各筆數據之主鍵字串,預設keyId
|
|
26
28
|
* @param {String} [opt.fdDwAttime] 輸入當前下載數據資料夾字串,預設'./_dwAttime'
|
|
27
29
|
* @param {String} [opt.fdDwCurrent] 輸入已下載數據資料夾字串,預設'./_dwCurrent'
|
|
28
|
-
* @param {String} [opt.fdResult]
|
|
30
|
+
* @param {String} [opt.fdResult] 輸入已下載數據所連動生成數據資料夾字串,預設`./_result`
|
|
29
31
|
* @param {String} [opt.fdTaskCpSrc] 輸入任務狀態之來源端資料夾字串,預設'./_taskCpSrc'
|
|
30
32
|
* @param {Function} [opt.funDownload] 輸入自定義下載函數,回傳資料陣列
|
|
31
33
|
* @param {Function} [opt.funGetCurrent] 輸入自定義取得當前資料函數,回傳資料陣列
|
|
@@ -64,6 +66,18 @@ import cropPic from './cropPic.mjs'
|
|
|
64
66
|
*/
|
|
65
67
|
let WDwdataTweq = async(yearStart, yearEnd, opt = {}) => {
|
|
66
68
|
|
|
69
|
+
//check yearStart
|
|
70
|
+
if (!isnum(yearStart)) {
|
|
71
|
+
throw new Error(`yearStart is not a number`)
|
|
72
|
+
}
|
|
73
|
+
yearStart = cint(yearStart)
|
|
74
|
+
|
|
75
|
+
//check yearEnd
|
|
76
|
+
if (!isnum(yearEnd)) {
|
|
77
|
+
throw new Error(`yearEnd is not a number`)
|
|
78
|
+
}
|
|
79
|
+
yearEnd = cint(yearEnd)
|
|
80
|
+
|
|
67
81
|
//keyId
|
|
68
82
|
let keyId = get(opt, 'keyId')
|
|
69
83
|
if (!isestr(keyId)) {
|
|
@@ -91,7 +105,7 @@ let WDwdataTweq = async(yearStart, yearEnd, opt = {}) => {
|
|
|
91
105
|
//fdResult
|
|
92
106
|
let fdResult = get(opt, 'fdResult')
|
|
93
107
|
if (!isestr(fdResult)) {
|
|
94
|
-
fdResult =
|
|
108
|
+
fdResult = `./_result`
|
|
95
109
|
}
|
|
96
110
|
if (!fsIsFolder(fdResult)) {
|
|
97
111
|
fsCreateFolder(fdResult)
|
package/src/parseData.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import cint from 'wsemi/src/cint.mjs'
|
|
|
6
6
|
import ot from 'dayjs'
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
let
|
|
9
|
+
let parseData = (o) => {
|
|
10
10
|
//heads:
|
|
11
11
|
// "eArea": "小區域有感地震",
|
|
12
12
|
// "eDetailsEvent": "第{0}號",
|
|
@@ -149,4 +149,4 @@ let parserEq = (o) => {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
|
|
152
|
-
export default
|
|
152
|
+
export default parseData
|