w-dwdata-hub 1.0.13 → 1.0.15
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-hub.umd.js +2 -2
- package/dist/w-dwdata-hub.umd.js.map +1 -1
- package/docs/WDwdataHub.mjs.html +1 -1
- package/docs/decodeEntities.mjs.html +1 -1
- package/docs/extractDivContent.mjs.html +1 -1
- package/docs/fetchAiNewsAggregator.mjs.html +2 -2
- package/docs/fetchAisixiang.mjs.html +13 -13
- package/docs/fetchCnyes.mjs.html +8 -8
- package/docs/fetchGuancha.mjs.html +15 -15
- package/docs/fetchHackerNews.mjs.html +2 -2
- package/docs/fetchMoneydj.mjs.html +4 -4
- package/docs/fetchMops.mjs.html +14 -14
- package/docs/fetchRSS.mjs.html +2 -2
- package/docs/fetchStatementdog.mjs.html +6 -6
- package/docs/fetchTaifex.mjs.html +14 -14
- package/docs/fetchTpex3insti.mjs.html +5 -5
- package/docs/fetchTpexMargin.mjs.html +5 -5
- package/docs/fetchTpexStock.mjs.html +4 -4
- package/docs/fetchTwDataHoliday.mjs.html +2 -2
- package/docs/fetchTwseMargin.mjs.html +5 -5
- package/docs/fetchTwseStock.mjs.html +4 -4
- package/docs/fetchTwseT86.mjs.html +5 -5
- package/docs/fetchWithRetry.mjs.html +7 -7
- package/docs/getOptFetch.mjs.html +9 -9
- package/docs/global.html +29 -29
- package/docs/htmlToMarkdown.mjs.html +1 -1
- package/docs/index.html +1 -1
- package/docs/isYmd.mjs.html +1 -1
- package/docs/parseIntComma.mjs.html +1 -1
- package/docs/safeFilename.mjs.html +1 -1
- package/docs/stripHtml.mjs.html +1 -1
- package/docs/toDatetimeUTC8.mjs.html +1 -1
- package/docs/toRocDate.mjs.html +1 -1
- package/g.mjs +13 -13
- package/package.json +5 -5
- package/src/fetchAiNewsAggregator.mjs +1 -1
- package/src/fetchAisixiang.mjs +12 -12
- package/src/fetchCnyes.mjs +7 -7
- package/src/fetchGuancha.mjs +14 -14
- package/src/fetchHackerNews.mjs +1 -1
- package/src/fetchMoneydj.mjs +3 -3
- package/src/fetchMops.mjs +13 -13
- package/src/fetchRSS.mjs +1 -1
- package/src/fetchStatementdog.mjs +5 -5
- package/src/fetchTaifex.mjs +13 -13
- package/src/fetchTpex3insti.mjs +4 -4
- package/src/fetchTpexMargin.mjs +4 -4
- package/src/fetchTpexStock.mjs +3 -3
- package/src/fetchTwDataHoliday.mjs +1 -1
- package/src/fetchTwseMargin.mjs +4 -4
- package/src/fetchTwseStock.mjs +3 -3
- package/src/fetchTwseT86.mjs +4 -4
- package/src/fetchWithRetry.mjs +6 -6
- package/src/getOptFetch.mjs +8 -8
- package/test/fetchAiNewsAggregator.test.mjs +5 -5
- package/test/fetchAisixiang.test.mjs +1 -1
- package/test/fetchCnyes.test.mjs +5 -5
- package/test/fetchGuancha.test.mjs +1 -1
- package/test/fetchHackerNews.test.mjs +5 -5
- package/test/fetchMoneydj.test.mjs +1 -1
- package/test/fetchMops.test.mjs +2 -2
- package/test/fetchRSS.test.mjs +11 -11
- package/test/fetchStatementdog.test.mjs +1 -1
- package/test/fetchTaifex.test.mjs +1 -1
- package/test/fetchTpex3insti.test.mjs +1 -1
- package/test/fetchTpexMargin.test.mjs +1 -1
- package/test/fetchTpexStock.test.mjs +1 -1
- package/test/fetchTwDataHoliday.test.mjs +1 -1
- package/test/fetchTwseMargin.test.mjs +1 -1
- package/test/fetchTwseStock.test.mjs +1 -1
- package/test/fetchTwseT86.test.mjs +1 -1
- package/test/fetchWithRetry.test.mjs +1 -1
|
@@ -146,7 +146,7 @@ function assertTpexFieldShape(fields) {
|
|
|
146
146
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
147
147
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
148
148
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
149
|
-
* @param {Boolean} [opt.
|
|
149
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
150
150
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{source,date,data},日期無效、無資料或欄位結構不符時reject回傳錯誤物件
|
|
151
151
|
* @example
|
|
152
152
|
*
|
|
@@ -185,7 +185,7 @@ async function fetchTpex3insti(dateStr, stockCodes, opt = {}) {
|
|
|
185
185
|
|
|
186
186
|
//optFetch
|
|
187
187
|
let optFetch = getOptFetch(opt, DFLT)
|
|
188
|
-
let
|
|
188
|
+
let useShowLog = optFetch.useShowLog
|
|
189
189
|
|
|
190
190
|
//targetCodes
|
|
191
191
|
let targetCodes = isearr(stockCodes) ? stockCodes : []
|
|
@@ -194,7 +194,7 @@ async function fetchTpex3insti(dateStr, stockCodes, opt = {}) {
|
|
|
194
194
|
let rocDateStr = toRocDate(dateStr)
|
|
195
195
|
let url = `${baseUrl}/web/stock/3insti/daily_trade/3itrade_hedge_result.php?l=zh-tw&t=D&d=${rocDateStr}&o=json`
|
|
196
196
|
|
|
197
|
-
if (
|
|
197
|
+
if (useShowLog) {
|
|
198
198
|
console.log(`Fetching from: ${url}`)
|
|
199
199
|
console.log(`Target: ${targetCodes.length === 0 ? 'All Market' : targetCodes.join(', ')}`)
|
|
200
200
|
}
|
|
@@ -241,7 +241,7 @@ async function fetchTpex3insti(dateStr, stockCodes, opt = {}) {
|
|
|
241
241
|
})
|
|
242
242
|
.filter((item) => targetCodes.length === 0 || targetCodes.includes(item['代號']))
|
|
243
243
|
|
|
244
|
-
if (
|
|
244
|
+
if (useShowLog) {
|
|
245
245
|
console.log(`Fetched ${processedData.length} records.`)
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -265,7 +265,7 @@ export default fetchTpex3insti
|
|
|
265
265
|
<br class="clear">
|
|
266
266
|
|
|
267
267
|
<footer>
|
|
268
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
268
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
269
269
|
</footer>
|
|
270
270
|
|
|
271
271
|
<script>prettyPrint();</script>
|
|
@@ -84,7 +84,7 @@ let DFLT = {
|
|
|
84
84
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
85
85
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
86
86
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
87
|
-
* @param {Boolean} [opt.
|
|
87
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
88
88
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{source,date,count,data},日期無效、無資料、欄位佈局不符或指定個股查無資料時reject回傳錯誤物件
|
|
89
89
|
* @example
|
|
90
90
|
*
|
|
@@ -122,7 +122,7 @@ async function fetchTpexMargin(dateStr, stockCodes, opt = {}) {
|
|
|
122
122
|
|
|
123
123
|
//optFetch
|
|
124
124
|
let optFetch = getOptFetch(opt, DFLT)
|
|
125
|
-
let
|
|
125
|
+
let useShowLog = optFetch.useShowLog
|
|
126
126
|
|
|
127
127
|
//targetCodes
|
|
128
128
|
let targetCodes = isearr(stockCodes) ? stockCodes.filter(Boolean) : []
|
|
@@ -131,7 +131,7 @@ async function fetchTpexMargin(dateStr, stockCodes, opt = {}) {
|
|
|
131
131
|
let rocDate = toRocDate(dateStr)
|
|
132
132
|
let url = `${baseUrl}/web/stock/margin_trading/margin_balance/margin_bal_result.php?l=zh-tw&d=${rocDate}&o=json`
|
|
133
133
|
|
|
134
|
-
if (
|
|
134
|
+
if (useShowLog) {
|
|
135
135
|
console.log(`Fetching TPEX margin data: ${dateStr} (${rocDate})`)
|
|
136
136
|
console.log(`Target: ${targetCodes.length > 0 ? targetCodes.join(', ') : 'All Market'}`)
|
|
137
137
|
console.log(`URL: ${url}`)
|
|
@@ -207,7 +207,7 @@ async function fetchTpexMargin(dateStr, stockCodes, opt = {}) {
|
|
|
207
207
|
}
|
|
208
208
|
})
|
|
209
209
|
|
|
210
|
-
if (
|
|
210
|
+
if (useShowLog) {
|
|
211
211
|
console.log(`Fetched ${parsedData.length} records.`)
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -235,7 +235,7 @@ export default fetchTpexMargin
|
|
|
235
235
|
<br class="clear">
|
|
236
236
|
|
|
237
237
|
<footer>
|
|
238
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
238
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
239
239
|
</footer>
|
|
240
240
|
|
|
241
241
|
<script>prettyPrint();</script>
|
|
@@ -87,7 +87,7 @@ let MIN_COLUMNS = 8
|
|
|
87
87
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
88
88
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
89
89
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
90
|
-
* @param {Boolean} [opt.
|
|
90
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
91
91
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{source,date,count,data},日期無效、無資料或指定個股查無資料時reject回傳錯誤物件
|
|
92
92
|
* @example
|
|
93
93
|
*
|
|
@@ -122,7 +122,7 @@ async function fetchTpexStock(dateStr, stockCodes, opt = {}) {
|
|
|
122
122
|
|
|
123
123
|
//optFetch
|
|
124
124
|
let optFetch = getOptFetch(opt, DFLT)
|
|
125
|
-
let
|
|
125
|
+
let useShowLog = optFetch.useShowLog
|
|
126
126
|
|
|
127
127
|
//targetCodes
|
|
128
128
|
let targetCodes = isearr(stockCodes) ? stockCodes : []
|
|
@@ -131,7 +131,7 @@ async function fetchTpexStock(dateStr, stockCodes, opt = {}) {
|
|
|
131
131
|
let rocDate = toRocDate(dateStr)
|
|
132
132
|
let url = `${baseUrl}/web/stock/aftertrading/daily_close_quotes/stk_quote_result.php?l=zh-tw&d=${rocDate}&s=0,asc,0&o=json`
|
|
133
133
|
|
|
134
|
-
if (
|
|
134
|
+
if (useShowLog) {
|
|
135
135
|
console.log(`Fetching TPEX data: ${dateStr} (${rocDate})`)
|
|
136
136
|
console.log(`Target: ${targetCodes.length > 0 ? targetCodes.join(', ') : 'All Market'}`)
|
|
137
137
|
console.log(`URL: ${url}`)
|
|
@@ -186,7 +186,7 @@ export default fetchTpexStock
|
|
|
186
186
|
<br class="clear">
|
|
187
187
|
|
|
188
188
|
<footer>
|
|
189
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
189
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
190
190
|
</footer>
|
|
191
191
|
|
|
192
192
|
<script>prettyPrint();</script>
|
|
@@ -117,7 +117,7 @@ function isNonHolidayEntry(entry) {
|
|
|
117
117
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
118
118
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
119
119
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
120
|
-
* @param {Boolean} [opt.
|
|
120
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示重試訊息布林值,預設true
|
|
121
121
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{dataYear,totalHolidays,holidays},有給checkDate時另含{checkDate,isHoliday,holidayName},API回傳非JSON或空陣列時reject回傳錯誤物件
|
|
122
122
|
* @example
|
|
123
123
|
*
|
|
@@ -223,7 +223,7 @@ export default fetchTwDataHoliday
|
|
|
223
223
|
<br class="clear">
|
|
224
224
|
|
|
225
225
|
<footer>
|
|
226
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
226
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
227
227
|
</footer>
|
|
228
228
|
|
|
229
229
|
<script>prettyPrint();</script>
|
|
@@ -86,7 +86,7 @@ let MIN_FIELDS = 16
|
|
|
86
86
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
87
87
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
88
88
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
89
|
-
* @param {Boolean} [opt.
|
|
89
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
90
90
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{source,date,count,data},日期無效、API錯誤或指定個股查無資料時reject回傳錯誤物件
|
|
91
91
|
* @example
|
|
92
92
|
*
|
|
@@ -124,7 +124,7 @@ async function fetchTwseMargin(dateStr, stockCodes, opt = {}) {
|
|
|
124
124
|
|
|
125
125
|
//optFetch
|
|
126
126
|
let optFetch = getOptFetch(opt, DFLT)
|
|
127
|
-
let
|
|
127
|
+
let useShowLog = optFetch.useShowLog
|
|
128
128
|
|
|
129
129
|
//targetCodes
|
|
130
130
|
let targetCodes = isearr(stockCodes) ? stockCodes.filter(Boolean) : []
|
|
@@ -132,7 +132,7 @@ async function fetchTwseMargin(dateStr, stockCodes, opt = {}) {
|
|
|
132
132
|
//url
|
|
133
133
|
let url = `${baseUrl}/rwd/zh/marginTrading/MI_MARGN?date=${dateStr}&selectType=ALL&response=json`
|
|
134
134
|
|
|
135
|
-
if (
|
|
135
|
+
if (useShowLog) {
|
|
136
136
|
console.log(`Fetching TWSE margin data: ${dateStr}`)
|
|
137
137
|
console.log(`Target: ${targetCodes.length > 0 ? targetCodes.join(', ') : 'All Market'}`)
|
|
138
138
|
console.log(`URL: ${url}`)
|
|
@@ -212,7 +212,7 @@ async function fetchTwseMargin(dateStr, stockCodes, opt = {}) {
|
|
|
212
212
|
}
|
|
213
213
|
})
|
|
214
214
|
|
|
215
|
-
if (
|
|
215
|
+
if (useShowLog) {
|
|
216
216
|
console.log(`Fetched ${parsedData.length} records.`)
|
|
217
217
|
}
|
|
218
218
|
|
|
@@ -240,7 +240,7 @@ export default fetchTwseMargin
|
|
|
240
240
|
<br class="clear">
|
|
241
241
|
|
|
242
242
|
<footer>
|
|
243
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
243
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
244
244
|
</footer>
|
|
245
245
|
|
|
246
246
|
<script>prettyPrint();</script>
|
|
@@ -81,7 +81,7 @@ let DFLT = {
|
|
|
81
81
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
82
82
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
83
83
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
84
|
-
* @param {Boolean} [opt.
|
|
84
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
85
85
|
* @returns {Promise} 回傳Promise,resolve回傳證交所API原始資料物件,內含fields與data等欄位,日期無效、API回傳非OK或指定日無交易資料時reject回傳錯誤物件
|
|
86
86
|
* @example
|
|
87
87
|
*
|
|
@@ -116,7 +116,7 @@ async function fetchTwseStock(dateStr, stockCode, opt = {}) {
|
|
|
116
116
|
|
|
117
117
|
//optFetch
|
|
118
118
|
let optFetch = getOptFetch(opt, DFLT)
|
|
119
|
-
let
|
|
119
|
+
let useShowLog = optFetch.useShowLog
|
|
120
120
|
|
|
121
121
|
//isSingleStock
|
|
122
122
|
let isSingleStock = isestr(stockCode) && stockCode.toLowerCase() !== 'all'
|
|
@@ -131,7 +131,7 @@ async function fetchTwseStock(dateStr, stockCode, opt = {}) {
|
|
|
131
131
|
url = `${baseUrl}/exchangeReport/MI_INDEX?response=json&date=${dateStr}&type=ALLBUT0999`
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
if (
|
|
134
|
+
if (useShowLog) {
|
|
135
135
|
console.log(`Fetching TWSE data: ${dateStr}, Stock: ${stockNo}`)
|
|
136
136
|
console.log(`URL: ${url}`)
|
|
137
137
|
}
|
|
@@ -175,7 +175,7 @@ export default fetchTwseStock
|
|
|
175
175
|
<br class="clear">
|
|
176
176
|
|
|
177
177
|
<footer>
|
|
178
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
178
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
179
179
|
</footer>
|
|
180
180
|
|
|
181
181
|
<script>prettyPrint();</script>
|
|
@@ -80,7 +80,7 @@ let DFLT = {
|
|
|
80
80
|
* @param {Integer} [opt.maxRetries=10] 輸入最大重試次數整數,含初始共執行maxRetries+1次,預設10
|
|
81
81
|
* @param {Integer} [opt.baseDelayMs=5000] 輸入重試之線性退避基礎毫秒整數,預設5000
|
|
82
82
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入重試之線性退避上限毫秒整數,預設30000
|
|
83
|
-
* @param {Boolean} [opt.
|
|
83
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示過程訊息布林值,預設true
|
|
84
84
|
* @returns {Promise} 回傳Promise,resolve回傳結果物件{source,date,data},日期無效或API錯誤時reject回傳錯誤物件
|
|
85
85
|
* @example
|
|
86
86
|
*
|
|
@@ -119,7 +119,7 @@ async function fetchTwseT86(dateStr, stockCodes, opt = {}) {
|
|
|
119
119
|
|
|
120
120
|
//optFetch
|
|
121
121
|
let optFetch = getOptFetch(opt, DFLT)
|
|
122
|
-
let
|
|
122
|
+
let useShowLog = optFetch.useShowLog
|
|
123
123
|
|
|
124
124
|
//targetCodes
|
|
125
125
|
let targetCodes = isearr(stockCodes) ? stockCodes : []
|
|
@@ -127,7 +127,7 @@ async function fetchTwseT86(dateStr, stockCodes, opt = {}) {
|
|
|
127
127
|
//url
|
|
128
128
|
let url = `${baseUrl}/rwd/zh/fund/T86?response=json&date=${dateStr}&selectType=ALL`
|
|
129
129
|
|
|
130
|
-
if (
|
|
130
|
+
if (useShowLog) {
|
|
131
131
|
console.log(`Fetching from: ${url}`)
|
|
132
132
|
console.log(`Target: ${targetCodes.length === 0 ? 'All Market' : targetCodes.join(', ')}`)
|
|
133
133
|
}
|
|
@@ -172,7 +172,7 @@ async function fetchTwseT86(dateStr, stockCodes, opt = {}) {
|
|
|
172
172
|
parsedData = parsedData.filter((item) => targetCodes.includes(item[codeField]))
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
if (
|
|
175
|
+
if (useShowLog) {
|
|
176
176
|
console.log(`Fetched ${parsedData.length} records.`)
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -195,7 +195,7 @@ export default fetchTwseT86
|
|
|
195
195
|
<br class="clear">
|
|
196
196
|
|
|
197
197
|
<footer>
|
|
198
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
198
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
199
199
|
</footer>
|
|
200
200
|
|
|
201
201
|
<script>prettyPrint();</script>
|
|
@@ -201,7 +201,7 @@ async function fetchOnce(url, cfg) {
|
|
|
201
201
|
* @param {Integer} [opt.maxDelayMs=30000] 輸入線性退避之上限毫秒整數,預設30000
|
|
202
202
|
* @param {Array} [opt.retryStatus=[]] 輸入額外視為可重試之HTTP狀態碼陣列,例如[403],預設[]
|
|
203
203
|
* @param {String} [opt.label=''] 輸入重試訊息前綴字串,預設''
|
|
204
|
-
* @param {Boolean} [opt.
|
|
204
|
+
* @param {Boolean} [opt.useShowLog=true] 輸入是否顯示重試訊息布林值,預設true
|
|
205
205
|
* @returns {Promise} 回傳Promise,resolve回傳解析後資料,responseType為'json'時回物件、'text'時回字串、'arrayBuffer'時回ArrayBuffer,重試耗盡或遇不可重試錯誤時reject回傳錯誤物件
|
|
206
206
|
* @example
|
|
207
207
|
*
|
|
@@ -308,10 +308,10 @@ async function fetchWithRetry(url, opt = {}) {
|
|
|
308
308
|
label = 'fetchWithRetry'
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
//
|
|
312
|
-
let
|
|
313
|
-
if (!isbol(
|
|
314
|
-
|
|
311
|
+
//useShowLog
|
|
312
|
+
let useShowLog = get(opt, 'useShowLog')
|
|
313
|
+
if (!isbol(useShowLog)) {
|
|
314
|
+
useShowLog = true
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
//cfg
|
|
@@ -334,7 +334,7 @@ async function fetchWithRetry(url, opt = {}) {
|
|
|
334
334
|
|
|
335
335
|
//線性退避
|
|
336
336
|
let ms = Math.min(baseDelayMs * attempt, maxDelayMs)
|
|
337
|
-
if (
|
|
337
|
+
if (useShowLog) {
|
|
338
338
|
console.warn(`[${label}][Retry ${attempt}/${maxRetries}] ${err.message} — 等待 ${ms / 1000}s 後重試...`)
|
|
339
339
|
}
|
|
340
340
|
await delay(ms)
|
|
@@ -363,7 +363,7 @@ export default fetchWithRetry
|
|
|
363
363
|
<br class="clear">
|
|
364
364
|
|
|
365
365
|
<footer>
|
|
366
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
366
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
367
367
|
</footer>
|
|
368
368
|
|
|
369
369
|
<script>prettyPrint();</script>
|
|
@@ -102,7 +102,7 @@ function pickPint(opt, dflt, key, fallback) {
|
|
|
102
102
|
* import getOptFetch from './src/getOptFetch.mjs'
|
|
103
103
|
*
|
|
104
104
|
* console.log(getOptFetch({ maxRetries: 2 }, { timeout: 15000, label: 'abc' }))
|
|
105
|
-
* // => { timeout: 15000, maxRetries: 2, baseDelayMs: 5000, maxDelayMs: 30000,
|
|
105
|
+
* // => { timeout: 15000, maxRetries: 2, baseDelayMs: 5000, maxDelayMs: 30000, useShowLog: true, label: 'abc' }
|
|
106
106
|
*
|
|
107
107
|
*/
|
|
108
108
|
function getOptFetch(opt = {}, dflt = {}) {
|
|
@@ -119,13 +119,13 @@ function getOptFetch(opt = {}, dflt = {}) {
|
|
|
119
119
|
maxRetries = cint(maxRetries)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
//
|
|
123
|
-
let
|
|
124
|
-
if (!isbol(
|
|
125
|
-
|
|
122
|
+
//useShowLog
|
|
123
|
+
let useShowLog = get(opt, 'useShowLog')
|
|
124
|
+
if (!isbol(useShowLog)) {
|
|
125
|
+
useShowLog = get(dflt, 'useShowLog')
|
|
126
126
|
}
|
|
127
|
-
if (!isbol(
|
|
128
|
-
|
|
127
|
+
if (!isbol(useShowLog)) {
|
|
128
|
+
useShowLog = true
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
let r = {
|
|
@@ -133,7 +133,7 @@ function getOptFetch(opt = {}, dflt = {}) {
|
|
|
133
133
|
maxRetries,
|
|
134
134
|
baseDelayMs: pickPint(opt, dflt, 'baseDelayMs', DEFAULT_BASE_DELAY_MS),
|
|
135
135
|
maxDelayMs: pickPint(opt, dflt, 'maxDelayMs', DEFAULT_MAX_DELAY_MS),
|
|
136
|
-
|
|
136
|
+
useShowLog,
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
//各函數固有特性, 不開放呼叫端覆寫
|
|
@@ -172,7 +172,7 @@ export default getOptFetch
|
|
|
172
172
|
<br class="clear">
|
|
173
173
|
|
|
174
174
|
<footer>
|
|
175
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
175
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
176
176
|
</footer>
|
|
177
177
|
|
|
178
178
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -1955,7 +1955,7 @@ await test()
|
|
|
1955
1955
|
|
|
1956
1956
|
<tr>
|
|
1957
1957
|
|
|
1958
|
-
<td class="name"><code>
|
|
1958
|
+
<td class="name"><code>useShowLog</code></td>
|
|
1959
1959
|
|
|
1960
1960
|
|
|
1961
1961
|
<td class="type">
|
|
@@ -2889,7 +2889,7 @@ await test()
|
|
|
2889
2889
|
|
|
2890
2890
|
<tr>
|
|
2891
2891
|
|
|
2892
|
-
<td class="name"><code>
|
|
2892
|
+
<td class="name"><code>useShowLog</code></td>
|
|
2893
2893
|
|
|
2894
2894
|
|
|
2895
2895
|
<td class="type">
|
|
@@ -3352,7 +3352,7 @@ await test()
|
|
|
3352
3352
|
|
|
3353
3353
|
<tr>
|
|
3354
3354
|
|
|
3355
|
-
<td class="name"><code>
|
|
3355
|
+
<td class="name"><code>useShowLog</code></td>
|
|
3356
3356
|
|
|
3357
3357
|
|
|
3358
3358
|
<td class="type">
|
|
@@ -3895,7 +3895,7 @@ await test()
|
|
|
3895
3895
|
|
|
3896
3896
|
<tr>
|
|
3897
3897
|
|
|
3898
|
-
<td class="name"><code>
|
|
3898
|
+
<td class="name"><code>useShowLog</code></td>
|
|
3899
3899
|
|
|
3900
3900
|
|
|
3901
3901
|
<td class="type">
|
|
@@ -4398,7 +4398,7 @@ await test()
|
|
|
4398
4398
|
|
|
4399
4399
|
<tr>
|
|
4400
4400
|
|
|
4401
|
-
<td class="name"><code>
|
|
4401
|
+
<td class="name"><code>useShowLog</code></td>
|
|
4402
4402
|
|
|
4403
4403
|
|
|
4404
4404
|
<td class="type">
|
|
@@ -4864,7 +4864,7 @@ await test()
|
|
|
4864
4864
|
|
|
4865
4865
|
<tr>
|
|
4866
4866
|
|
|
4867
|
-
<td class="name"><code>
|
|
4867
|
+
<td class="name"><code>useShowLog</code></td>
|
|
4868
4868
|
|
|
4869
4869
|
|
|
4870
4870
|
<td class="type">
|
|
@@ -5290,7 +5290,7 @@ await test()
|
|
|
5290
5290
|
|
|
5291
5291
|
<tr>
|
|
5292
5292
|
|
|
5293
|
-
<td class="name"><code>
|
|
5293
|
+
<td class="name"><code>useShowLog</code></td>
|
|
5294
5294
|
|
|
5295
5295
|
|
|
5296
5296
|
<td class="type">
|
|
@@ -5917,7 +5917,7 @@ await test()
|
|
|
5917
5917
|
|
|
5918
5918
|
<tr>
|
|
5919
5919
|
|
|
5920
|
-
<td class="name"><code>
|
|
5920
|
+
<td class="name"><code>useShowLog</code></td>
|
|
5921
5921
|
|
|
5922
5922
|
|
|
5923
5923
|
<td class="type">
|
|
@@ -6607,7 +6607,7 @@ await test()
|
|
|
6607
6607
|
|
|
6608
6608
|
<tr>
|
|
6609
6609
|
|
|
6610
|
-
<td class="name"><code>
|
|
6610
|
+
<td class="name"><code>useShowLog</code></td>
|
|
6611
6611
|
|
|
6612
6612
|
|
|
6613
6613
|
<td class="type">
|
|
@@ -7474,7 +7474,7 @@ await test()
|
|
|
7474
7474
|
|
|
7475
7475
|
<tr>
|
|
7476
7476
|
|
|
7477
|
-
<td class="name"><code>
|
|
7477
|
+
<td class="name"><code>useShowLog</code></td>
|
|
7478
7478
|
|
|
7479
7479
|
|
|
7480
7480
|
<td class="type">
|
|
@@ -8290,7 +8290,7 @@ await test()
|
|
|
8290
8290
|
|
|
8291
8291
|
<tr>
|
|
8292
8292
|
|
|
8293
|
-
<td class="name"><code>
|
|
8293
|
+
<td class="name"><code>useShowLog</code></td>
|
|
8294
8294
|
|
|
8295
8295
|
|
|
8296
8296
|
<td class="type">
|
|
@@ -8678,7 +8678,7 @@ await test()
|
|
|
8678
8678
|
|
|
8679
8679
|
<tr>
|
|
8680
8680
|
|
|
8681
|
-
<td class="name"><code>
|
|
8681
|
+
<td class="name"><code>useShowLog</code></td>
|
|
8682
8682
|
|
|
8683
8683
|
|
|
8684
8684
|
<td class="type">
|
|
@@ -9594,7 +9594,7 @@ await test()
|
|
|
9594
9594
|
|
|
9595
9595
|
<tr>
|
|
9596
9596
|
|
|
9597
|
-
<td class="name"><code>
|
|
9597
|
+
<td class="name"><code>useShowLog</code></td>
|
|
9598
9598
|
|
|
9599
9599
|
|
|
9600
9600
|
<td class="type">
|
|
@@ -10061,7 +10061,7 @@ await test()
|
|
|
10061
10061
|
|
|
10062
10062
|
<tr>
|
|
10063
10063
|
|
|
10064
|
-
<td class="name"><code>
|
|
10064
|
+
<td class="name"><code>useShowLog</code></td>
|
|
10065
10065
|
|
|
10066
10066
|
|
|
10067
10067
|
<td class="type">
|
|
@@ -10604,7 +10604,7 @@ await test()
|
|
|
10604
10604
|
|
|
10605
10605
|
<tr>
|
|
10606
10606
|
|
|
10607
|
-
<td class="name"><code>
|
|
10607
|
+
<td class="name"><code>useShowLog</code></td>
|
|
10608
10608
|
|
|
10609
10609
|
|
|
10610
10610
|
<td class="type">
|
|
@@ -11314,7 +11314,7 @@ await test()
|
|
|
11314
11314
|
|
|
11315
11315
|
<tr>
|
|
11316
11316
|
|
|
11317
|
-
<td class="name"><code>
|
|
11317
|
+
<td class="name"><code>useShowLog</code></td>
|
|
11318
11318
|
|
|
11319
11319
|
|
|
11320
11320
|
<td class="type">
|
|
@@ -12090,7 +12090,7 @@ await test()
|
|
|
12090
12090
|
|
|
12091
12091
|
<tr>
|
|
12092
12092
|
|
|
12093
|
-
<td class="name"><code>
|
|
12093
|
+
<td class="name"><code>useShowLog</code></td>
|
|
12094
12094
|
|
|
12095
12095
|
|
|
12096
12096
|
<td class="type">
|
|
@@ -12593,7 +12593,7 @@ await test()
|
|
|
12593
12593
|
|
|
12594
12594
|
<tr>
|
|
12595
12595
|
|
|
12596
|
-
<td class="name"><code>
|
|
12596
|
+
<td class="name"><code>useShowLog</code></td>
|
|
12597
12597
|
|
|
12598
12598
|
|
|
12599
12599
|
<td class="type">
|
|
@@ -13059,7 +13059,7 @@ await test()
|
|
|
13059
13059
|
|
|
13060
13060
|
<tr>
|
|
13061
13061
|
|
|
13062
|
-
<td class="name"><code>
|
|
13062
|
+
<td class="name"><code>useShowLog</code></td>
|
|
13063
13063
|
|
|
13064
13064
|
|
|
13065
13065
|
<td class="type">
|
|
@@ -13600,7 +13600,7 @@ await test()
|
|
|
13600
13600
|
|
|
13601
13601
|
<tr>
|
|
13602
13602
|
|
|
13603
|
-
<td class="name"><code>
|
|
13603
|
+
<td class="name"><code>useShowLog</code></td>
|
|
13604
13604
|
|
|
13605
13605
|
|
|
13606
13606
|
<td class="type">
|
|
@@ -14142,7 +14142,7 @@ await test()
|
|
|
14142
14142
|
|
|
14143
14143
|
<tr>
|
|
14144
14144
|
|
|
14145
|
-
<td class="name"><code>
|
|
14145
|
+
<td class="name"><code>useShowLog</code></td>
|
|
14146
14146
|
|
|
14147
14147
|
|
|
14148
14148
|
<td class="type">
|
|
@@ -14683,7 +14683,7 @@ await test()
|
|
|
14683
14683
|
|
|
14684
14684
|
<tr>
|
|
14685
14685
|
|
|
14686
|
-
<td class="name"><code>
|
|
14686
|
+
<td class="name"><code>useShowLog</code></td>
|
|
14687
14687
|
|
|
14688
14688
|
|
|
14689
14689
|
<td class="type">
|
|
@@ -15188,7 +15188,7 @@ await test()
|
|
|
15188
15188
|
|
|
15189
15189
|
<tr>
|
|
15190
15190
|
|
|
15191
|
-
<td class="name"><code>
|
|
15191
|
+
<td class="name"><code>useShowLog</code></td>
|
|
15192
15192
|
|
|
15193
15193
|
|
|
15194
15194
|
<td class="type">
|
|
@@ -15729,7 +15729,7 @@ await test()
|
|
|
15729
15729
|
|
|
15730
15730
|
<tr>
|
|
15731
15731
|
|
|
15732
|
-
<td class="name"><code>
|
|
15732
|
+
<td class="name"><code>useShowLog</code></td>
|
|
15733
15733
|
|
|
15734
15734
|
|
|
15735
15735
|
<td class="type">
|
|
@@ -16270,7 +16270,7 @@ await test()
|
|
|
16270
16270
|
|
|
16271
16271
|
<tr>
|
|
16272
16272
|
|
|
16273
|
-
<td class="name"><code>
|
|
16273
|
+
<td class="name"><code>useShowLog</code></td>
|
|
16274
16274
|
|
|
16275
16275
|
|
|
16276
16276
|
<td class="type">
|
|
@@ -16810,7 +16810,7 @@ await test()
|
|
|
16810
16810
|
|
|
16811
16811
|
<tr>
|
|
16812
16812
|
|
|
16813
|
-
<td class="name"><code>
|
|
16813
|
+
<td class="name"><code>useShowLog</code></td>
|
|
16814
16814
|
|
|
16815
16815
|
|
|
16816
16816
|
<td class="type">
|
|
@@ -17555,7 +17555,7 @@ await test()
|
|
|
17555
17555
|
|
|
17556
17556
|
<tr>
|
|
17557
17557
|
|
|
17558
|
-
<td class="name"><code>
|
|
17558
|
+
<td class="name"><code>useShowLog</code></td>
|
|
17559
17559
|
|
|
17560
17560
|
|
|
17561
17561
|
<td class="type">
|
|
@@ -18073,7 +18073,7 @@ responseType、encoding、headers、retryStatus與label屬各函數固有特性,
|
|
|
18073
18073
|
<pre class="prettyprint"><code>import getOptFetch from './src/getOptFetch.mjs'
|
|
18074
18074
|
|
|
18075
18075
|
console.log(getOptFetch({ maxRetries: 2 }, { timeout: 15000, label: 'abc' }))
|
|
18076
|
-
// => { timeout: 15000, maxRetries: 2, baseDelayMs: 5000, maxDelayMs: 30000,
|
|
18076
|
+
// => { timeout: 15000, maxRetries: 2, baseDelayMs: 5000, maxDelayMs: 30000, useShowLog: true, label: 'abc' }</code></pre>
|
|
18077
18077
|
|
|
18078
18078
|
|
|
18079
18079
|
|
|
@@ -23292,7 +23292,7 @@ console.log(toRocDate('20260807'), toRocDate('19110101'))
|
|
|
23292
23292
|
<br class="clear">
|
|
23293
23293
|
|
|
23294
23294
|
<footer>
|
|
23295
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
23295
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
23296
23296
|
</footer>
|
|
23297
23297
|
|
|
23298
23298
|
<script>prettyPrint();</script>
|
|
@@ -155,7 +155,7 @@ export default htmlToMarkdown
|
|
|
155
155
|
<br class="clear">
|
|
156
156
|
|
|
157
157
|
<footer>
|
|
158
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
158
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
159
159
|
</footer>
|
|
160
160
|
|
|
161
161
|
<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.5</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 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/docs/isYmd.mjs.html
CHANGED
|
@@ -101,7 +101,7 @@ export default isYmd
|
|
|
101
101
|
<br class="clear">
|
|
102
102
|
|
|
103
103
|
<footer>
|
|
104
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
104
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Sep 13 2026 14:29:36 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
105
105
|
</footer>
|
|
106
106
|
|
|
107
107
|
<script>prettyPrint();</script>
|