wsemi 1.8.11 → 1.8.13
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/README.md +11 -18
- package/dist/wsemi.umd.js +5 -5
- package/dist/wsemi.umd.js.map +1 -1
- package/docs/-_class.mjs.html +2 -2
- package/docs/ab2blob.mjs.html +2 -2
- package/docs/ab2u8arr.mjs.html +2 -2
- package/docs/addExcelWorksheetFromData.mjs.html +2 -2
- package/docs/addMonth.mjs.html +2 -2
- package/docs/aes2str.mjs.html +2 -2
- package/docs/alive.mjs.html +2 -2
- package/docs/arr2dt.mjs.html +2 -2
- package/docs/arrAccum.mjs.html +2 -2
- package/docs/arrAdd.mjs.html +2 -2
- package/docs/arrAt.mjs.html +2 -2
- package/docs/arrDiff.mjs.html +2 -2
- package/docs/arrFilterByKeywords.mjs.html +2 -2
- package/docs/arrFilterByNum.mjs.html +2 -2
- package/docs/arrFilterByPnum.mjs.html +2 -2
- package/docs/arrFilterByPnumAndToLog.mjs.html +2 -2
- package/docs/arrFind.mjs.html +2 -2
- package/docs/arrGroupByMaxmin.mjs.html +2 -2
- package/docs/arrHas.mjs.html +2 -2
- package/docs/arrInsert.mjs.html +2 -2
- package/docs/arrLookupByMaxmin.mjs.html +2 -2
- package/docs/arrMax.mjs.html +2 -2
- package/docs/arrMin.mjs.html +2 -2
- package/docs/arrMulti.mjs.html +2 -2
- package/docs/arrNorm.mjs.html +2 -2
- package/docs/arrProduct.mjs.html +2 -2
- package/docs/arrPull.mjs.html +2 -2
- package/docs/arrPullAt.mjs.html +2 -2
- package/docs/arrReduce.mjs.html +2 -2
- package/docs/arrReverse.mjs.html +2 -2
- package/docs/arrSep.mjs.html +2 -2
- package/docs/arrSort.mjs.html +2 -2
- package/docs/asind.mjs.html +2 -2
- package/docs/atan2d.mjs.html +2 -2
- package/docs/atand.mjs.html +2 -2
- package/docs/attstr.mjs.html +2 -2
- package/docs/b642obj.mjs.html +2 -2
- package/docs/b642str.mjs.html +2 -2
- package/docs/b642u16arr.mjs.html +2 -2
- package/docs/b642u8arr.mjs.html +2 -2
- package/docs/binstr.mjs.html +2 -2
- package/docs/blob2ab.mjs.html +2 -2
- package/docs/blob2b64.mjs.html +2 -2
- package/docs/blob2str.mjs.html +2 -2
- package/docs/blob2u8arr.mjs.html +2 -2
- package/docs/blobs2b64s.mjs.html +2 -2
- package/docs/blobs2u8arrs.mjs.html +2 -2
- package/docs/bodyLog.mjs.html +2 -2
- package/docs/browserView.mjs.html +2 -2
- package/docs/browserViewFromBlob.mjs.html +2 -2
- package/docs/browserViewFromText.mjs.html +2 -2
- package/docs/browserViewFromU8arr.mjs.html +2 -2
- package/docs/bs2u8arr.mjs.html +2 -2
- package/docs/bufRead.mjs.html +2 -2
- package/docs/bufReadDbl.mjs.html +2 -2
- package/docs/bufWrite.mjs.html +2 -2
- package/docs/bufWriteDbl.mjs.html +2 -2
- package/docs/cache.mjs.html +3 -3
- package/docs/cacheBd.mjs.html +309 -0
- package/docs/cbol.mjs.html +2 -2
- package/docs/cdbl.mjs.html +2 -2
- package/docs/ceil.mjs.html +2 -2
- package/docs/cfilesize.mjs.html +2 -2
- package/docs/cfinancial.mjs.html +2 -2
- package/docs/cint.mjs.html +2 -2
- package/docs/clearXSS.mjs.html +2 -2
- package/docs/clearXSSDyn.mjs.html +2 -2
- package/docs/color.mjs.html +2 -2
- package/docs/composeToTree.mjs.html +2 -2
- package/docs/convertToTree.mjs.html +2 -2
- package/docs/copyStrToClipboard.mjs.html +2 -2
- package/docs/cosd.mjs.html +2 -2
- package/docs/cotd.mjs.html +2 -2
- package/docs/createExcelWorkbook.mjs.html +2 -2
- package/docs/cscd.mjs.html +2 -2
- package/docs/cstr.mjs.html +2 -2
- package/docs/day2cht.mjs.html +2 -2
- package/docs/debounce.mjs.html +2 -2
- package/docs/delay.mjs.html +2 -2
- package/docs/dig.mjs.html +2 -2
- package/docs/digExp.mjs.html +2 -2
- package/docs/domAlert.mjs.html +2 -2
- package/docs/domAppend.mjs.html +2 -2
- package/docs/domCancelEvent.mjs.html +2 -2
- package/docs/domCompareText.mjs.html +2 -2
- package/docs/domCompareTextDyn.mjs.html +2 -2
- package/docs/domConvertToPic.mjs.html +2 -2
- package/docs/domConvertToPicDyn.mjs.html +2 -2
- package/docs/domDetect.mjs.html +2 -2
- package/docs/domDrag.mjs.html +2 -2
- package/docs/domDragBarAndScroll.mjs.html +2 -2
- package/docs/domDragPreview.mjs.html +2 -2
- package/docs/domDropFiles.mjs.html +2 -2
- package/docs/domElementsFromPoint.mjs.html +2 -2
- package/docs/domFadeIn.mjs.html +2 -2
- package/docs/domFadeOut.mjs.html +2 -2
- package/docs/domFind.mjs.html +2 -2
- package/docs/domFinds.mjs.html +2 -2
- package/docs/domGetAttr.mjs.html +2 -2
- package/docs/domGetBoudRect.mjs.html +2 -2
- package/docs/domGetBoudRectRefSelf.mjs.html +2 -2
- package/docs/domGetFileAccept.mjs.html +2 -2
- package/docs/domGetFiles.mjs.html +2 -2
- package/docs/domGetParents.mjs.html +2 -2
- package/docs/domGetPointFromEvent.mjs.html +2 -2
- package/docs/domGetScrollableParent.mjs.html +2 -2
- package/docs/domGetWindowSize.mjs.html +2 -2
- package/docs/domIsClientXYIn.mjs.html +2 -2
- package/docs/domIsFocused.mjs.html +2 -2
- package/docs/domIsVisible.mjs.html +2 -2
- package/docs/domPrepend.mjs.html +2 -2
- package/docs/domRemove.mjs.html +2 -2
- package/docs/domRenderMarkdownMind.mjs.html +2 -2
- package/docs/domRenderMarkdownMindDyn.mjs.html +2 -2
- package/docs/domRipple.mjs.html +2 -2
- package/docs/domScrollIntoView.mjs.html +2 -2
- package/docs/domScrollTo.mjs.html +2 -2
- package/docs/domShowImages.mjs.html +2 -2
- package/docs/domShowImagesDyn.mjs.html +2 -2
- package/docs/domShowInputAndGetFiles.mjs.html +2 -2
- package/docs/domShowInputAndGetFilesU8Arrs.mjs.html +2 -2
- package/docs/domShowInputDatatime.mjs.html +2 -2
- package/docs/domTooltip.mjs.html +2 -2
- package/docs/domTriggerEvent.mjs.html +2 -2
- package/docs/domVirtualCreate.mjs.html +2 -2
- package/docs/domVirtualCreateQueue.mjs.html +2 -2
- package/docs/downloadExcelFileFromData.mjs.html +2 -2
- package/docs/downloadExcelFileFromDataDyn.mjs.html +2 -2
- package/docs/downloadFileFromB64.mjs.html +2 -2
- package/docs/downloadFileFromBlob.mjs.html +2 -2
- package/docs/downloadFileFromText.mjs.html +2 -2
- package/docs/downloadFileFromU8Arr.mjs.html +2 -2
- package/docs/dtmapping.mjs.html +2 -2
- package/docs/dtpick.mjs.html +2 -2
- package/docs/estimateTicks.mjs.html +2 -2
- package/docs/evem.mjs.html +2 -2
- package/docs/examples/ex-blob2b64.html +1 -1
- package/docs/examples/ex-clearXSS.html +1 -1
- package/docs/examples/ex-clearXSSDyn.html +1 -1
- package/docs/examples/ex-colorConverter.html +1 -1
- package/docs/examples/ex-domCompareText.html +1 -1
- package/docs/examples/ex-domCompareTextDyn.html +1 -1
- package/docs/examples/ex-domConvertToPic.html +1 -1
- package/docs/examples/ex-domConvertToPicDyn.html +1 -1
- package/docs/examples/ex-domDrag.html +1 -1
- package/docs/examples/ex-domDropFiles.html +1 -1
- package/docs/examples/ex-domIsVisible.html +1 -1
- package/docs/examples/ex-domRenderMarkdownMind.html +1 -1
- package/docs/examples/ex-domRenderMarkdownMindDyn.html +1 -1
- package/docs/examples/ex-domRipple.html +1 -1
- package/docs/examples/ex-domScrollIntoView.html +1 -1
- package/docs/examples/ex-domScrollTo.html +1 -1
- package/docs/examples/ex-domShowImages.html +1 -1
- package/docs/examples/ex-domShowImagesDyn.html +1 -1
- package/docs/examples/ex-domShowInputAndGetFiles.html +1 -1
- package/docs/examples/ex-domTooltip.html +1 -1
- package/docs/examples/ex-execPyodide.html +1 -1
- package/docs/examples/ex-execPyodideDyn.html +1 -1
- package/docs/examples/ex-getFileHash.html +1 -1
- package/docs/examples/ex-getUserAgent.html +1 -1
- package/docs/examples/ex-getUserAgentDyn.html +1 -1
- package/docs/examples/ex-html2pic.html +1 -1
- package/docs/examples/ex-html2picDyn.html +1 -1
- package/docs/examples/ex-html2str.html +1 -1
- package/docs/examples/ex-html2strDyn.html +1 -1
- package/docs/examples/ex-obj2u8arr-u8arr2obj.html +1 -1
- package/docs/examples/ex-ocr.html +1 -1
- package/docs/examples/ex-ocrDyn.html +1 -1
- package/docs/examples/ex-openLink.html +1 -1
- package/docs/examples/ex-str2aes-aes2str.html +1 -1
- package/docs/examples/ex-str2b64-b642str.html +1 -1
- package/docs/examples/ex-strFindFuzz.html +1 -1
- package/docs/examples/ex-strFindFuzzDyn.html +1 -1
- package/docs/examples/ex-timeTZ2expire-timeTZ2past.html +1 -1
- package/docs/examples/ex-xlsx.html +1 -1
- package/docs/examples/ex-xlsxDyn.html +1 -1
- package/docs/execProcess.mjs.html +2 -2
- package/docs/execProcessKillPid.mjs.html +2 -2
- package/docs/execPyodide.mjs.html +2 -2
- package/docs/execPyodideDyn.mjs.html +2 -2
- package/docs/f2c.mjs.html +2 -2
- package/docs/filepathToTree.mjs.html +2 -2
- package/docs/files2data.mjs.html +2 -2
- package/docs/flattenToConn.mjs.html +2 -2
- package/docs/flattenTree.mjs.html +2 -2
- package/docs/floor.mjs.html +2 -2
- package/docs/fsBuildReadStreamText.mjs.html +181 -0
- package/docs/fsBuildWriteStreamText.mjs.html +10 -5
- package/docs/fsCleanFolder.mjs.html +2 -2
- package/docs/fsCleanFolderCore.mjs.html +2 -2
- package/docs/fsCopyFile.mjs.html +2 -2
- package/docs/fsCopyFileCore.mjs.html +2 -2
- package/docs/fsCopyFolder.mjs.html +2 -2
- package/docs/fsCopyFolderCore.mjs.html +2 -2
- package/docs/fsCreateFile.mjs.html +2 -2
- package/docs/fsCreateFileCore.mjs.html +2 -2
- package/docs/fsCreateFolder.mjs.html +2 -2
- package/docs/fsCreateFolderCore.mjs.html +2 -2
- package/docs/fsDeleteFile.mjs.html +2 -2
- package/docs/fsDeleteFileCore.mjs.html +2 -2
- package/docs/fsDeleteFileSafe.mjs.html +2 -2
- package/docs/fsDeleteFileSafeCore.mjs.html +2 -2
- package/docs/fsDeleteFolder.mjs.html +2 -2
- package/docs/fsDeleteFolderCore.mjs.html +2 -2
- package/docs/fsDeleteFolderSafe.mjs.html +2 -2
- package/docs/fsDeleteFolderSafeCore.mjs.html +2 -2
- package/docs/fsDownloadFile.mjs.html +2 -2
- package/docs/fsDownloadFileCore.mjs.html +2 -2
- package/docs/fsEvem.mjs.html +2 -2
- package/docs/fsGetFileBasicHash.mjs.html +2 -2
- package/docs/fsGetFileBasicHashCore.mjs.html +2 -2
- package/docs/fsGetFileHash.mjs.html +2 -2
- package/docs/fsGetFileHashCore.mjs.html +2 -2
- package/docs/fsGetFileXxHash.mjs.html +2 -2
- package/docs/fsGetFileXxHashCore.mjs.html +2 -2
- package/docs/fsGetFilesInFolder.mjs.html +2 -2
- package/docs/fsGetFilesInFolderCore.mjs.html +2 -2
- package/docs/fsGetFilesWithHashInFolder.mjs.html +2 -2
- package/docs/fsGetFilesWithHashInFolderCore.mjs.html +2 -2
- package/docs/fsGetFoldersInFolder.mjs.html +2 -2
- package/docs/fsGetFoldersInFolderCore.mjs.html +2 -2
- package/docs/fsIsFile.mjs.html +2 -2
- package/docs/fsIsFileCore.mjs.html +2 -2
- package/docs/fsIsFolder.mjs.html +2 -2
- package/docs/fsIsFolderCore.mjs.html +2 -2
- package/docs/fsMergeFiles.mjs.html +2 -2
- package/docs/fsMergeFilesCore.mjs.html +2 -2
- package/docs/fsReadText.mjs.html +2 -2
- package/docs/fsReadTextCore.mjs.html +2 -2
- package/docs/fsRenameFile.mjs.html +2 -2
- package/docs/fsRenameFileCore.mjs.html +2 -2
- package/docs/fsRenameFolder.mjs.html +2 -2
- package/docs/fsRenameFolderCore.mjs.html +2 -2
- package/docs/fsSrlog.mjs.html +2 -2
- package/docs/fsTask.mjs.html +2 -2
- package/docs/fsTreeFolder.mjs.html +2 -2
- package/docs/fsTreeFolderCore.mjs.html +2 -2
- package/docs/fsWatchFile.mjs.html +2 -2
- package/docs/fsWatchFolder.mjs.html +2 -2
- package/docs/fsWriteText.mjs.html +2 -2
- package/docs/fsWriteTextCore.mjs.html +2 -2
- package/docs/genGradientColor.mjs.html +2 -2
- package/docs/genID.mjs.html +2 -2
- package/docs/genPm.mjs.html +2 -2
- package/docs/getBufferSize.mjs.html +2 -2
- package/docs/getClearPathName.mjs.html +2 -2
- package/docs/getCsvStrFromData.mjs.html +2 -2
- package/docs/getDataFromExcelFileU8Arr.mjs.html +2 -2
- package/docs/getDataFromExcelFileU8ArrDyn.mjs.html +2 -2
- package/docs/getEnv.mjs.html +2 -2
- package/docs/getExcelU8ArrFromData.mjs.html +2 -2
- package/docs/getExcelU8ArrFromWorkbook.mjs.html +2 -2
- package/docs/getExcelWorkbookFromData.mjs.html +2 -2
- package/docs/getExcelWorkbookFromWorksheet.mjs.html +2 -2
- package/docs/getExcelWorksheetFromData.mjs.html +2 -2
- package/docs/getFileAccept.mjs.html +2 -2
- package/docs/getFileBasicHash.mjs.html +2 -2
- package/docs/getFileHash.mjs.html +2 -2
- package/docs/getFileName.mjs.html +2 -2
- package/docs/getFileNameExt.mjs.html +2 -2
- package/docs/getFileTrueName.mjs.html +2 -2
- package/docs/getFileType.mjs.html +2 -2
- package/docs/getFileXxHash.mjs.html +2 -2
- package/docs/getGlobal.mjs.html +2 -2
- package/docs/getObjSize.mjs.html +2 -2
- package/docs/getPathParent.mjs.html +2 -2
- package/docs/getTimeBetween.mjs.html +2 -2
- package/docs/getTimeFromUnit.mjs.html +2 -2
- package/docs/getTimeHp.mjs.html +2 -2
- package/docs/getTimeObject.mjs.html +2 -2
- package/docs/getTimeRange.mjs.html +2 -2
- package/docs/getUserAgent.mjs.html +2 -2
- package/docs/getUserAgentDyn.mjs.html +2 -2
- package/docs/getltdtkeys.mjs.html +2 -2
- package/docs/haskey.mjs.html +2 -2
- package/docs/html2pic.mjs.html +2 -2
- package/docs/html2picDyn.mjs.html +2 -2
- package/docs/html2str.mjs.html +2 -2
- package/docs/html2strDyn.mjs.html +2 -2
- package/docs/htmlDecode.mjs.html +2 -2
- package/docs/htmlEncode.mjs.html +2 -2
- package/docs/importResources.mjs.html +2 -2
- package/docs/index.html +2 -2
- package/docs/interp1.mjs.html +2 -2
- package/docs/isDate.mjs.html +2 -2
- package/docs/isDev.mjs.html +2 -2
- package/docs/isEle.mjs.html +2 -2
- package/docs/isEleExistByID.mjs.html +2 -2
- package/docs/isEmail.mjs.html +2 -2
- package/docs/isErr.mjs.html +2 -2
- package/docs/isIE.mjs.html +2 -2
- package/docs/isNarrow.mjs.html +2 -2
- package/docs/isStrHasCapital.mjs.html +2 -2
- package/docs/isStrHasLowerCase.mjs.html +2 -2
- package/docs/isStrHasNumber.mjs.html +2 -2
- package/docs/isUserIdentify.mjs.html +2 -2
- package/docs/isUserName.mjs.html +2 -2
- package/docs/isUserPW.mjs.html +2 -2
- package/docs/isWindow.mjs.html +2 -2
- package/docs/isab.mjs.html +2 -2
- package/docs/isarr.mjs.html +2 -2
- package/docs/isarr0.mjs.html +2 -2
- package/docs/isblob.mjs.html +2 -2
- package/docs/isbol.mjs.html +2 -2
- package/docs/isday.mjs.html +2 -2
- package/docs/isearr.mjs.html +2 -2
- package/docs/iseobj.mjs.html +2 -2
- package/docs/iser.mjs.html +2 -2
- package/docs/isernot.mjs.html +2 -2
- package/docs/isestr.mjs.html +2 -2
- package/docs/isfile.mjs.html +2 -2
- package/docs/isfun.mjs.html +2 -2
- package/docs/isint.mjs.html +2 -2
- package/docs/ismonth.mjs.html +2 -2
- package/docs/isn0int.mjs.html +2 -2
- package/docs/isn0num.mjs.html +2 -2
- package/docs/isnan.mjs.html +2 -2
- package/docs/isnbr.mjs.html +2 -2
- package/docs/isnint.mjs.html +2 -2
- package/docs/isnnum.mjs.html +2 -2
- package/docs/isnull.mjs.html +2 -2
- package/docs/isnum.mjs.html +2 -2
- package/docs/isobj.mjs.html +2 -2
- package/docs/isobj0.mjs.html +2 -2
- package/docs/isp0int.mjs.html +2 -2
- package/docs/isp0num.mjs.html +2 -2
- package/docs/ispint.mjs.html +2 -2
- package/docs/ispm.mjs.html +2 -2
- package/docs/ispnum.mjs.html +2 -2
- package/docs/isstr.mjs.html +2 -2
- package/docs/isstr0.mjs.html +2 -2
- package/docs/istime.mjs.html +2 -2
- package/docs/istimeTZ.mjs.html +2 -2
- package/docs/istimems.mjs.html +2 -2
- package/docs/istimemsTZ.mjs.html +2 -2
- package/docs/isu16arr.mjs.html +2 -2
- package/docs/isu8arr.mjs.html +2 -2
- package/docs/isundefined.mjs.html +2 -2
- package/docs/j2o.mjs.html +2 -2
- package/docs/judge.mjs.html +2 -2
- package/docs/keysmat2ltdt.mjs.html +2 -2
- package/docs/log.mjs.html +2 -2
- package/docs/ltdt2vrtsable.mjs.html +2 -2
- package/docs/ltdtDiff.mjs.html +2 -2
- package/docs/ltdtDiffByKey.mjs.html +2 -2
- package/docs/ltdtkeys2mat.mjs.html +2 -2
- package/docs/ltdtkeysheads2mat.mjs.html +2 -2
- package/docs/ltdtmapping.mjs.html +2 -2
- package/docs/ltdtmerge.mjs.html +2 -2
- package/docs/ltdtpick.mjs.html +2 -2
- package/docs/ltdtpull.mjs.html +2 -2
- package/docs/mat2ltdt.mjs.html +2 -2
- package/docs/matConcat.mjs.html +2 -2
- package/docs/matDiff.mjs.html +2 -2
- package/docs/matat.mjs.html +2 -2
- package/docs/now2str.mjs.html +2 -2
- package/docs/now2strp.mjs.html +2 -2
- package/docs/nowDay2str.mjs.html +2 -2
- package/docs/nowms2str.mjs.html +2 -2
- package/docs/nowms2strp.mjs.html +2 -2
- package/docs/o2j.mjs.html +2 -2
- package/docs/obj2b64.mjs.html +2 -2
- package/docs/obj2pb64.mjs.html +2 -2
- package/docs/obj2str.mjs.html +2 -2
- package/docs/obj2stru8arr.mjs.html +2 -2
- package/docs/obj2u8arr.mjs.html +2 -2
- package/docs/objSortBy.mjs.html +2 -2
- package/docs/objSortByKeys.mjs.html +2 -2
- package/docs/ocr.mjs.html +2 -2
- package/docs/ocrDyn.mjs.html +2 -2
- package/docs/oo.mjs.html +2 -2
- package/docs/openLink.mjs.html +2 -2
- package/docs/pb642obj.mjs.html +2 -2
- package/docs/pmChain.mjs.html +2 -2
- package/docs/pmConvertResolve.mjs.html +2 -2
- package/docs/pmDebounce.mjs.html +2 -49
- package/docs/pmHook.mjs.html +2 -2
- package/docs/pmHookReject.mjs.html +2 -2
- package/docs/pmIni.mjs.html +2 -2
- package/docs/pmInvResolve.mjs.html +2 -2
- package/docs/pmMap.mjs.html +10 -3
- package/docs/pmQueue.mjs.html +2 -2
- package/docs/pmSeries.mjs.html +2 -2
- package/docs/pmThrottle.mjs.html +3 -3
- package/docs/preciseNum.mjs.html +2 -2
- package/docs/pseudoRandom.mjs.html +2 -2
- package/docs/pseudoRandomIntRange.mjs.html +2 -2
- package/docs/pseudoRandomIntsNdpRange.mjs.html +2 -2
- package/docs/pseudoRandomIntsRange.mjs.html +2 -2
- package/docs/pseudoRandomRange.mjs.html +2 -2
- package/docs/pseudoRandomsRange.mjs.html +2 -2
- package/docs/queue.mjs.html +3 -3
- package/docs/random.mjs.html +2 -2
- package/docs/randomIntRange.mjs.html +2 -2
- package/docs/randomIntsNdpRange.mjs.html +2 -2
- package/docs/randomIntsRange.mjs.html +2 -2
- package/docs/randomRange.mjs.html +2 -2
- package/docs/randomsRange.mjs.html +2 -2
- package/docs/rang.mjs.html +2 -2
- package/docs/rep.mjs.html +2 -2
- package/docs/repObj.mjs.html +2 -2
- package/docs/replace.mjs.html +2 -2
- package/docs/replaceObj.mjs.html +2 -2
- package/docs/replacePlus.mjs.html +2 -2
- package/docs/round.mjs.html +2 -2
- package/docs/secd.mjs.html +2 -2
- package/docs/sep.mjs.html +2 -2
- package/docs/sepInt.mjs.html +2 -2
- package/docs/setIntervalHp.mjs.html +2 -2
- package/docs/setTimeoutHp.mjs.html +2 -2
- package/docs/sind.mjs.html +2 -2
- package/docs/split.mjs.html +2 -2
- package/docs/str2aes.mjs.html +2 -2
- package/docs/str2b64.mjs.html +2 -2
- package/docs/str2hint.mjs.html +2 -2
- package/docs/str2md5.mjs.html +2 -2
- package/docs/str2obj.mjs.html +2 -2
- package/docs/str2sha512.mjs.html +2 -2
- package/docs/str2u8arr.mjs.html +2 -2
- package/docs/strCompare.mjs.html +2 -2
- package/docs/strDiff.mjs.html +2 -2
- package/docs/strFindFuzz.mjs.html +2 -2
- package/docs/strFindFuzzDyn.mjs.html +2 -2
- package/docs/strFindSimilar.mjs.html +2 -2
- package/docs/strdelleft.mjs.html +2 -2
- package/docs/strdelright.mjs.html +2 -2
- package/docs/strleft.mjs.html +2 -2
- package/docs/strmid.mjs.html +2 -2
- package/docs/strright.mjs.html +2 -2
- package/docs/stru8arr2obj.mjs.html +2 -2
- package/docs/tand.mjs.html +2 -2
- package/docs/time2day.mjs.html +2 -2
- package/docs/time2hour.mjs.html +2 -2
- package/docs/time2min.mjs.html +2 -2
- package/docs/timeTZ2day.mjs.html +2 -2
- package/docs/timeTZ2expire.mjs.html +2 -2
- package/docs/timeTZ2hour.mjs.html +2 -2
- package/docs/timeTZ2min.mjs.html +2 -2
- package/docs/timeTZ2past.mjs.html +2 -2
- package/docs/timems2day.mjs.html +2 -2
- package/docs/timems2hour.mjs.html +2 -2
- package/docs/timems2min.mjs.html +2 -2
- package/docs/timems2time.mjs.html +2 -2
- package/docs/timemsTZ2day.mjs.html +2 -2
- package/docs/timemsTZ2expire.mjs.html +2 -2
- package/docs/timemsTZ2hour.mjs.html +2 -2
- package/docs/timemsTZ2min.mjs.html +2 -2
- package/docs/timemsTZ2past.mjs.html +2 -2
- package/docs/timemsTZ2time.mjs.html +2 -2
- package/docs/treeObj.mjs.html +2 -2
- package/docs/treeToFilepath.mjs.html +2 -2
- package/docs/trim.mjs.html +2 -2
- package/docs/u16arr2b64.mjs.html +2 -2
- package/docs/u16arr2u8arr.mjs.html +2 -2
- package/docs/u8arr2ab.mjs.html +2 -2
- package/docs/u8arr2b64.mjs.html +2 -2
- package/docs/u8arr2blob.mjs.html +2 -2
- package/docs/u8arr2bs.mjs.html +2 -2
- package/docs/u8arr2obj.mjs.html +2 -2
- package/docs/u8arr2str.mjs.html +2 -2
- package/docs/u8arr2u16arr.mjs.html +2 -2
- package/docs/urlParse.mjs.html +2 -2
- package/docs/verifyValue.mjs.html +2 -2
- package/docs/waitFun.mjs.html +2 -2
- package/docs/wsemi.html +658 -42
- package/g.mjs +145 -27
- package/package.json +1 -1
- package/src/cache.mjs +1 -1
- package/src/cacheBd.mjs +237 -0
- package/src/fsBuildReadStreamText.mjs +109 -0
- package/src/fsBuildWriteStreamText.mjs +8 -3
- package/src/index.mjs +2 -0
- package/src/pmDebounce.mjs +0 -47
- package/src/pmMap.mjs +8 -1
- package/src/pmThrottle.mjs +1 -1
- package/src/queue.mjs +1 -1
- package/test/cacheBd.test.mjs +174 -0
- package/test/fsBuildReadStreamText.test.mjs +68 -0
- package/toolfp/dist/wsemip.umd.js +2 -2
- package/toolparfor/dist/wpf.umd.js +2 -2
- package/toolparfor/dist/wpf_pmSeries.umd.js +1 -1
package/g.mjs
CHANGED
|
@@ -6,47 +6,165 @@ import fsCreateFolder from './src/fsCreateFolder.mjs'
|
|
|
6
6
|
import fsDeleteFolder from './src/fsDeleteFolder.mjs'
|
|
7
7
|
import fsSrlog from './src/fsSrlog.mjs'
|
|
8
8
|
import dig from './src/dig.mjs'
|
|
9
|
-
import
|
|
9
|
+
import genPm from './src/genPm.mjs'
|
|
10
|
+
import delay from './src/delay.mjs'
|
|
11
|
+
import cacheBd from './src/cacheBd.mjs'
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
let test1 = async () => {
|
|
12
15
|
let ms = []
|
|
13
16
|
|
|
14
|
-
let
|
|
15
|
-
|
|
17
|
+
let fun = async(p1, p2) => {
|
|
18
|
+
await delay(300)
|
|
19
|
+
return `${p1}:${p2}`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let bc = cacheBd(fun)
|
|
23
|
+
let execFun = bc.get
|
|
24
|
+
let execFunCache = bc.getByCache
|
|
16
25
|
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
await fsDownloadFile(urlIn, fpOut)
|
|
26
|
+
let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待
|
|
27
|
+
pm1
|
|
20
28
|
.then((res) => {
|
|
21
|
-
console.log('res', res)
|
|
22
|
-
ms.push({
|
|
29
|
+
// console.log('res', res)
|
|
30
|
+
ms.push({ result: `pm1-${res}` })
|
|
23
31
|
})
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
|
|
33
|
+
let pm2 = execFun(4.56, 'def') //pm2執行原本函數與使用輸入, 會最先回傳, 且更新快取給等待或之後取得快取使用
|
|
34
|
+
pm2
|
|
35
|
+
.then((res) => {
|
|
36
|
+
// console.log('res', res)
|
|
37
|
+
ms.push({ result: `pm2-${res}` })
|
|
26
38
|
})
|
|
27
39
|
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
41
|
+
pm3
|
|
42
|
+
.then((res) => {
|
|
43
|
+
// console.log('res', res)
|
|
44
|
+
ms.push({ result: `pm3-${res}` })
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
await Promise.all([pm1, pm2, pm3])
|
|
48
|
+
// console.log('rs', rs)
|
|
49
|
+
|
|
50
|
+
console.log('ms', ms)
|
|
51
|
+
return ms
|
|
52
|
+
}
|
|
53
|
+
await test1()
|
|
54
|
+
// ms [
|
|
55
|
+
// { result: 'pm2-4.56:def' },
|
|
56
|
+
// { result: 'pm1-4.56:def' },
|
|
57
|
+
// { result: 'pm3-4.56:def' }
|
|
58
|
+
// ]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
let test2 = async () => {
|
|
62
|
+
let ms = []
|
|
63
|
+
|
|
64
|
+
let fun = async(p1, p2) => {
|
|
65
|
+
await delay(300)
|
|
66
|
+
return `${p1}:${p2}`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let bc = cacheBd(fun)
|
|
70
|
+
let execFun = bc.get
|
|
71
|
+
let execFunCache = bc.getByCache
|
|
72
|
+
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
console.log('pm1 exec..')
|
|
75
|
+
let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待
|
|
76
|
+
pm1
|
|
77
|
+
.then((res) => {
|
|
78
|
+
console.log('pm1 then', res)
|
|
79
|
+
ms.push({ result: `pm1-${res}` })
|
|
80
|
+
})
|
|
81
|
+
}, 1)
|
|
82
|
+
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
console.log('pm2 exec..')
|
|
85
|
+
let pm2 = execFun(4.56, 'def') //1000ms後, pm2執行原本函數與使用輸入, 會最先回傳, 且更新快取給等待或之後取得快取使用
|
|
86
|
+
pm2
|
|
87
|
+
.then((res) => {
|
|
88
|
+
console.log('pm2 then', res)
|
|
89
|
+
ms.push({ result: `pm2-${res}` })
|
|
90
|
+
})
|
|
91
|
+
}, 1000)
|
|
92
|
+
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
console.log('pm3 exec..')
|
|
95
|
+
let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
96
|
+
pm3
|
|
97
|
+
.then((res) => {
|
|
98
|
+
console.log('pm3 then', res)
|
|
99
|
+
ms.push({ result: `pm3-${res}` })
|
|
100
|
+
})
|
|
101
|
+
}, 3000)
|
|
102
|
+
|
|
103
|
+
await delay(5000)
|
|
104
|
+
|
|
105
|
+
console.log('ms', ms)
|
|
106
|
+
return ms
|
|
107
|
+
}
|
|
108
|
+
await test2()
|
|
109
|
+
// ms [
|
|
110
|
+
// { result: 'pm2-4.56:def' },
|
|
111
|
+
// { result: 'pm1-4.56:def' },
|
|
112
|
+
// { result: 'pm3-4.56:def' }
|
|
113
|
+
// ]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
let test3 = async () => {
|
|
117
|
+
let ms = []
|
|
118
|
+
|
|
119
|
+
let fun = async(p1, p2) => {
|
|
120
|
+
await delay(300)
|
|
121
|
+
return `${p1}:${p2}`
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
let bc = cacheBd(fun)
|
|
125
|
+
let execFun = bc.get
|
|
126
|
+
let execFunCache = bc.getByCache
|
|
127
|
+
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
console.log('pm1 exec..')
|
|
130
|
+
let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待, 3000ms將執行get與自己的輸入, 並最先回傳
|
|
131
|
+
pm1
|
|
132
|
+
.then((res) => {
|
|
133
|
+
console.log('pm1 then', res)
|
|
134
|
+
ms.push({ result: `pm1-${res}` })
|
|
135
|
+
})
|
|
136
|
+
}, 1)
|
|
137
|
+
|
|
138
|
+
setTimeout(() => {
|
|
139
|
+
console.log('pm2 exec..')
|
|
140
|
+
let pm2 = execFun(4.56, 'def') //3500ms後, pm2執行原本函數與使用輸入, 計算完畢則會覆蓋快取, 此快取將再給等待或之後取得快取使用
|
|
141
|
+
pm2
|
|
142
|
+
.then((res) => {
|
|
143
|
+
console.log('pm2 then', res)
|
|
144
|
+
ms.push({ result: `pm2-${res}` })
|
|
145
|
+
})
|
|
146
|
+
}, 3500)
|
|
147
|
+
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
console.log('pm3 exec..')
|
|
150
|
+
let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
151
|
+
pm3
|
|
152
|
+
.then((res) => {
|
|
153
|
+
console.log('pm3 then', res)
|
|
154
|
+
ms.push({ result: `pm3-${res}` })
|
|
155
|
+
})
|
|
156
|
+
}, 4500)
|
|
31
157
|
|
|
32
|
-
|
|
158
|
+
await delay(6500)
|
|
33
159
|
|
|
34
160
|
console.log('ms', ms)
|
|
35
161
|
return ms
|
|
36
162
|
}
|
|
37
|
-
await
|
|
38
|
-
.catch((err) => {
|
|
39
|
-
console.log(err)
|
|
40
|
-
})
|
|
163
|
+
await test3()
|
|
41
164
|
// ms [
|
|
42
|
-
// {
|
|
43
|
-
// {
|
|
44
|
-
//
|
|
45
|
-
// 10.55 10.54a2.51 2.51 0 0 0 3.5599 0 2 2 0 0 0 0.26999-0.30994l18.48-25.4-5.8901-5.8899a2.52 2.52 0 0 0-3.4699-0.089l-23.49 21.14z" style="fill:#aab0b1;"/><path d="m158.41 199.58-10.11-3.2401v29.93q5.1601-1.5299 10.11-3.51zm-75.82 26.66v-29.9l-10.1 3.2401v23.14c3.2901 1.3199 6.67 2.4999 10.1 3.5199z" style="fill:#aab0b1;"/><path d="m157.79 67.5a61.31 61.31 0 0 1-42.79 17.43h-55.7c18.16-37.74 68.27-46.85 98.49-17.43z" style="fill:#531148;"/><path d="m122.93 7.0078c-10.503-0.15729-21.09 1.6448-29.545 5.4316-17.141 7.8999-32.169 23.297-43.973 38.779-5.1703 6.8631-8.7779 13.46-8.1855 18.395 0.93114 12.312 10.372 26.483 11.068 36.9 15.663-72.081 105.99-70.452 124.91-7.0525l4e-3 0.0156c5.616-10.926 8.0682-20.188 8.352-27.653 0.43654-15.607-7.8088-21.149-21.735-28.249 1.7934-3.7704 1.7273-7.5023
|
|
46
|
-
// 2.0625-10.154-0.79964-7.8568-3.6796-13.51-10.43-17.758-5.9434-3.7404-13.06-6.0867-18.463-7.2266-4.5319-0.87895-9.2901-1.3562-14.064-1.4277z" style="fill:#531148;"/><path d="m42.426 75.338c0.52158 18.689 10.557 74.338-18.115 101.25 12.38 10.603 28.352 19.061 46.025 24.594 11.032-4.6874 22.88-7.4147 34.817-8.5046l0.0633-14.477c-22.49-4.3813-40.766-18.898-48.862-39.967-8.096-21.07-4.7931-44.72 9.2478-62.393zm124.67 2.7207c7.8997 10.886 11.743 24.64 11.787 37.441-0.36632 30.178-22.389 57.576-53.12 62.708l0.0238 14.471c12.282 1.1216 24.518 3.9888 35.825 8.9128 15.488-5.1448 30.007-13.325 42.396-25.043-13.136-22.051-23.282-63.045-18.694-101.55z" style="fill:#531148;"/><path d="m143.61 46.383c-11.639 0.12482-20.998 1.8906-20.998 1.8906l-9 3.5059c0.63003-0.0191 1.2603-0.0289 1.8906-0.0293h0.0996c35.169 0.055 60.959 27.235 63.283 63.383 7.4e-4 31.157-22.742 57.213-53.106 63.079l-0.0216 14.498c11.567 1.0563 23.154 3.6067 33.887 8.0463 35.952-15.315 55.082-52.303 36.709-68.279-5.018-7.9035-10.44-15.409-9.5544-23.03 5.0545-50.452 0.39626-63.561-43.189-63.064zm-69.966 21.09c-15.286 3.244-17.096 3.73-31.734 6.6953 3.0304 13.081 3.0583 22.274 1.2085 30.012-3.8004 11.361-8.9712 19.787-12.286 28.764-6.8823 22.459-2.9157 31.982 12.093 46.165 8.6595 8.0693 19.861 16.209 30.939 20.647 2.669-1.0316 5.3729-1.9628 8.106-2.792 7.4979-2.275 15.388-3.6535 23.206-4.3673l0.0433-14.393c-23.933-4.5937-44.283-21.98-50.77-45.817-6.3319-23.265 0.51104-48.752 19.195-64.914z" style="fill:none;"/><path d="m172.7 90.75h-6.54c-0.14-0.1-0.26-0.22-0.4-0.3-4.48-2.76-22.75-2.11-33.71 1.2-1 0.3-1.91 0.61-2.75 0.94-1.8937 0.79244-3.8739 1.3597-5.9 1.69-5.5051 0.79002-10.403 0.79002-15.908 0-2.0261-0.33034-4.0063-0.89756-5.9-1.69-0.84-0.33-1.76-0.64-2.75-0.94-11-3.31-29.23-4-33.71-1.2-0.13832 0.08869-0.2688 0.18906-0.39 0.3h-6.55c-1.1046 0-2 0.89543-2 2v4.66c-0.0013 0.98185 0.49088 1.8986 1.31 2.44l1.9 1.27c0.59238 0.38889 0.93475
|
|
47
|
-
// 1.0622 0.9 1.77-0.14175 5.4854 0.88072 10.939 3 16 3.58 8.38 16 10.9 24.93 10.9 2.6976 0.0771 5.3921-0.2361 8-0.93 4.35-1.43 8.24-7.36 10.45-12.42 1.7607-3.8506 2.7493-8.009 2.91-12.24 7.3e-4 -0.7138 0.38183-1.3731 1-1.73 3.2281-1.951 6.5798-1.951 9.8079 0 0.61817 0.3569 0.99927 1.0162 1 1.73 0.16067 4.231 1.1493 8.3894 2.91 12.24 2.21 5.06 6.1 11 10.45 12.42 2.6079 0.6939 5.3024 1.0071 8 0.93 8.92 0 21.35-2.52 24.93-10.9 2.1193-5.0614 3.1418-10.515 3-16-0.0348-0.70778 0.30762-1.3811 0.9-1.77l1.9-1.27c0.81913-0.54136 1.3113-1.4582 1.31-2.44v-4.6c0.0336-1.1048-0.83521-2.0274-1.94-2.06z" style="fill:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:2.5;stroke:none;"/><polygon points="121.61 160.74 109.39 160.74 115.5 171.31" style="fill:#666;"/><path d="m132.64 144.06a34.42 34.42
|
|
48
|
-
// 0 0 1-34.24 0" style="fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:5.9998px;stroke:#000;"/></svg>'
|
|
49
|
-
// }
|
|
165
|
+
// { result: 'pm1-123:abc' },
|
|
166
|
+
// { result: 'pm2-4.56:def' },
|
|
167
|
+
// { result: 'pm3-4.56:def' }
|
|
50
168
|
// ]
|
|
51
169
|
|
|
52
170
|
//node g.mjs
|
package/package.json
CHANGED
package/src/cache.mjs
CHANGED
package/src/cacheBd.mjs
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import get from 'lodash-es/get.js'
|
|
2
|
+
import ispint from './ispint.mjs'
|
|
3
|
+
import cint from './cint.mjs'
|
|
4
|
+
import delay from './delay.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 封裝非同步函數與再提供使用快取版
|
|
9
|
+
*
|
|
10
|
+
* Unit Test: {@link https://github.com/yuda-lyu/wsemi/blob/master/test/cacheBd.test.mjs Github}
|
|
11
|
+
* @memberOf wsemi
|
|
12
|
+
* @param {Function} fun 輸入非同步函數
|
|
13
|
+
* @param {Object} [opt={}] 輸入設定物件,預設{}
|
|
14
|
+
* @param {Integer} [nMax=200] 輸入使用快取版之總嘗試次數整數,超過則報錯,預設200
|
|
15
|
+
* @param {Integer} [nTrigger=3] 輸入嘗試指定次數整數,若嘗試指定次數之後皆無快取則須自動執行get用以取得快取,預設3
|
|
16
|
+
* @returns {Object} 回傳事件物件,可呼叫事件get、getByCache,get為封裝後封裝原本非同步函數,getByCache為提供取用快取版之非同步函數,若有快取則優先使用,若超過指定次數則自動執行get使能取得快取
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* let test1 = async () => {
|
|
20
|
+
* let ms = []
|
|
21
|
+
*
|
|
22
|
+
* let fun = async(p1, p2) => {
|
|
23
|
+
* await delay(300)
|
|
24
|
+
* return `${p1}:${p2}`
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* let bc = cacheBd(fun)
|
|
28
|
+
* let execFun = bc.get
|
|
29
|
+
* let execFunCache = bc.getByCache
|
|
30
|
+
*
|
|
31
|
+
* let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待
|
|
32
|
+
* pm1
|
|
33
|
+
* .then((res) => {
|
|
34
|
+
* // console.log('res', res)
|
|
35
|
+
* ms.push({ result: `pm1-${res}` })
|
|
36
|
+
* })
|
|
37
|
+
*
|
|
38
|
+
* let pm2 = execFun(4.56, 'def') //pm2執行原本函數與使用輸入, 會最先回傳, 且更新快取給等待或之後取得快取使用
|
|
39
|
+
* pm2
|
|
40
|
+
* .then((res) => {
|
|
41
|
+
* // console.log('res', res)
|
|
42
|
+
* ms.push({ result: `pm2-${res}` })
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
46
|
+
* pm3
|
|
47
|
+
* .then((res) => {
|
|
48
|
+
* // console.log('res', res)
|
|
49
|
+
* ms.push({ result: `pm3-${res}` })
|
|
50
|
+
* })
|
|
51
|
+
*
|
|
52
|
+
* await Promise.all([pm1, pm2, pm3])
|
|
53
|
+
* // console.log('rs', rs)
|
|
54
|
+
*
|
|
55
|
+
* console.log('ms', ms)
|
|
56
|
+
* return ms
|
|
57
|
+
* }
|
|
58
|
+
* await test1()
|
|
59
|
+
* // ms [
|
|
60
|
+
* // { result: 'pm2-4.56:def' },
|
|
61
|
+
* // { result: 'pm1-4.56:def' },
|
|
62
|
+
* // { result: 'pm3-4.56:def' }
|
|
63
|
+
* // ]
|
|
64
|
+
*
|
|
65
|
+
* let test2 = async () => {
|
|
66
|
+
* let ms = []
|
|
67
|
+
*
|
|
68
|
+
* let fun = async(p1, p2) => {
|
|
69
|
+
* await delay(300)
|
|
70
|
+
* return `${p1}:${p2}`
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* let bc = cacheBd(fun)
|
|
74
|
+
* let execFun = bc.get
|
|
75
|
+
* let execFunCache = bc.getByCache
|
|
76
|
+
*
|
|
77
|
+
* setTimeout(() => {
|
|
78
|
+
* console.log('pm1 exec..')
|
|
79
|
+
* let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待
|
|
80
|
+
* pm1
|
|
81
|
+
* .then((res) => {
|
|
82
|
+
* console.log('pm1 then', res)
|
|
83
|
+
* ms.push({ result: `pm1-${res}` })
|
|
84
|
+
* })
|
|
85
|
+
* }, 1)
|
|
86
|
+
*
|
|
87
|
+
* setTimeout(() => {
|
|
88
|
+
* console.log('pm2 exec..')
|
|
89
|
+
* let pm2 = execFun(4.56, 'def') //1000ms後, pm2執行原本函數與使用輸入, 會最先回傳, 且更新快取給等待或之後取得快取使用
|
|
90
|
+
* pm2
|
|
91
|
+
* .then((res) => {
|
|
92
|
+
* console.log('pm2 then', res)
|
|
93
|
+
* ms.push({ result: `pm2-${res}` })
|
|
94
|
+
* })
|
|
95
|
+
* }, 1000)
|
|
96
|
+
*
|
|
97
|
+
* setTimeout(() => {
|
|
98
|
+
* console.log('pm3 exec..')
|
|
99
|
+
* let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
100
|
+
* pm3
|
|
101
|
+
* .then((res) => {
|
|
102
|
+
* console.log('pm3 then', res)
|
|
103
|
+
* ms.push({ result: `pm3-${res}` })
|
|
104
|
+
* })
|
|
105
|
+
* }, 3000)
|
|
106
|
+
*
|
|
107
|
+
* await delay(5000)
|
|
108
|
+
*
|
|
109
|
+
* console.log('ms', ms)
|
|
110
|
+
* return ms
|
|
111
|
+
* }
|
|
112
|
+
* await test2()
|
|
113
|
+
* // ms [
|
|
114
|
+
* // { result: 'pm2-4.56:def' },
|
|
115
|
+
* // { result: 'pm1-4.56:def' },
|
|
116
|
+
* // { result: 'pm3-4.56:def' }
|
|
117
|
+
* // ]
|
|
118
|
+
*
|
|
119
|
+
* let test3 = async () => {
|
|
120
|
+
* let ms = []
|
|
121
|
+
*
|
|
122
|
+
* let fun = async(p1, p2) => {
|
|
123
|
+
* await delay(300)
|
|
124
|
+
* return `${p1}:${p2}`
|
|
125
|
+
* }
|
|
126
|
+
*
|
|
127
|
+
* let bc = cacheBd(fun)
|
|
128
|
+
* let execFun = bc.get
|
|
129
|
+
* let execFunCache = bc.getByCache
|
|
130
|
+
*
|
|
131
|
+
* setTimeout(() => {
|
|
132
|
+
* console.log('pm1 exec..')
|
|
133
|
+
* let pm1 = execFunCache(123, 'abc') //pm1執行取得快取, 因無快取將持續等待, 3000ms將執行get與自己的輸入, 並最先回傳
|
|
134
|
+
* pm1
|
|
135
|
+
* .then((res) => {
|
|
136
|
+
* console.log('pm1 then', res)
|
|
137
|
+
* ms.push({ result: `pm1-${res}` })
|
|
138
|
+
* })
|
|
139
|
+
* }, 1)
|
|
140
|
+
*
|
|
141
|
+
* setTimeout(() => {
|
|
142
|
+
* console.log('pm2 exec..')
|
|
143
|
+
* let pm2 = execFun(4.56, 'def') //3500ms後, pm2執行原本函數與使用輸入, 計算完畢則會覆蓋快取, 此快取將再給等待或之後取得快取使用
|
|
144
|
+
* pm2
|
|
145
|
+
* .then((res) => {
|
|
146
|
+
* console.log('pm2 then', res)
|
|
147
|
+
* ms.push({ result: `pm2-${res}` })
|
|
148
|
+
* })
|
|
149
|
+
* }, 3500)
|
|
150
|
+
*
|
|
151
|
+
* setTimeout(() => {
|
|
152
|
+
* console.log('pm3 exec..')
|
|
153
|
+
* let pm3 = execFunCache(78.9, 'xyz') //pm3執行取得快取, 因已有快取將直接取得快取
|
|
154
|
+
* pm3
|
|
155
|
+
* .then((res) => {
|
|
156
|
+
* console.log('pm3 then', res)
|
|
157
|
+
* ms.push({ result: `pm3-${res}` })
|
|
158
|
+
* })
|
|
159
|
+
* }, 4500)
|
|
160
|
+
*
|
|
161
|
+
* await delay(6500)
|
|
162
|
+
*
|
|
163
|
+
* console.log('ms', ms)
|
|
164
|
+
* return ms
|
|
165
|
+
* }
|
|
166
|
+
* await test3()
|
|
167
|
+
* // ms [
|
|
168
|
+
* // { result: 'pm1-123:abc' },
|
|
169
|
+
* // { result: 'pm2-4.56:def' },
|
|
170
|
+
* // { result: 'pm3-4.56:def' }
|
|
171
|
+
* // ]
|
|
172
|
+
*
|
|
173
|
+
*/
|
|
174
|
+
function cacheBd(fun, opt = {}) {
|
|
175
|
+
|
|
176
|
+
//nMax
|
|
177
|
+
let nMax = get(opt, 'nMax')
|
|
178
|
+
if (!ispint(nMax)) {
|
|
179
|
+
nMax = 200
|
|
180
|
+
}
|
|
181
|
+
nMax = cint(nMax)
|
|
182
|
+
|
|
183
|
+
//nTrigger
|
|
184
|
+
let nTrigger = get(opt, 'nTrigger')
|
|
185
|
+
if (!ispint(nTrigger)) {
|
|
186
|
+
nTrigger = 3
|
|
187
|
+
}
|
|
188
|
+
nTrigger = cint(nTrigger)
|
|
189
|
+
|
|
190
|
+
//快取
|
|
191
|
+
let cc = null
|
|
192
|
+
|
|
193
|
+
//函數執行狀態
|
|
194
|
+
let lock = false
|
|
195
|
+
|
|
196
|
+
//_get, 封裝原本非同步函數
|
|
197
|
+
let _get = async(...inputs) => {
|
|
198
|
+
lock = true
|
|
199
|
+
cc = await fun(...inputs) //若發生錯誤則向外報錯
|
|
200
|
+
lock = false
|
|
201
|
+
return cc
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
//_getByCache, 提供取用快取版之非同步函數, 若有快取則優先使用, 若超過指定次數則執行get使能取得快取
|
|
205
|
+
let _getByCache = async(...inputs) => {
|
|
206
|
+
for (let i = 1; i <= nMax; i++) {
|
|
207
|
+
|
|
208
|
+
//exec
|
|
209
|
+
if (i > nTrigger && !lock) {
|
|
210
|
+
// console.log('執行get使能取得快取...')
|
|
211
|
+
await _get(...inputs)
|
|
212
|
+
.catch(() => {}) //取得快取時不向外報錯
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
//check
|
|
216
|
+
if (cc !== null) {
|
|
217
|
+
break
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
//delay
|
|
221
|
+
await delay(1000) //偵測週期1000ms
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
if (cc === null) {
|
|
225
|
+
throw new Error(`exceeded nMax[${nMax}]`)
|
|
226
|
+
}
|
|
227
|
+
return cc
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
get: _get,
|
|
232
|
+
getByCache: _getByCache,
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
export default cacheBd
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import readline from 'readline'
|
|
3
|
+
import fsIsFile from './fsIsFile.mjs'
|
|
4
|
+
import evem from './evem.mjs'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 使用stream從檔案讀utf8文字
|
|
9
|
+
*
|
|
10
|
+
* Unit Test: {@link https://github.com/yuda-lyu/wsemi/blob/master/test/fsBuildReadStreamText.test.mjs Github}
|
|
11
|
+
* @memberOf wsemi
|
|
12
|
+
* @param {String} fp 輸入讀取檔案路徑字串
|
|
13
|
+
* @returns {EventEmitter} 回傳EventEmitter,可監聽create、line、close事件,line事件接收讀入各列字串
|
|
14
|
+
* @example
|
|
15
|
+
* need test in nodejs.
|
|
16
|
+
*
|
|
17
|
+
* let test = async () => {
|
|
18
|
+
*
|
|
19
|
+
* let ms = []
|
|
20
|
+
*
|
|
21
|
+
* let fdt = './_test_fsBuildReadStreamText'
|
|
22
|
+
* fsCreateFolder(fdt) //創建臨時任務資料夾
|
|
23
|
+
*
|
|
24
|
+
* let fn = 't1.txt'
|
|
25
|
+
* let fp = `${fdt}/${fn}`
|
|
26
|
+
*
|
|
27
|
+
* fs.writeFileSync(fp, `abc
|
|
28
|
+
* 測試中文
|
|
29
|
+
* def123xyz
|
|
30
|
+
* `, 'utf8')
|
|
31
|
+
*
|
|
32
|
+
* let ev = fsBuildReadStreamText(fp)
|
|
33
|
+
* ms.push({ 'create': '' })
|
|
34
|
+
*
|
|
35
|
+
* ev.on('line', (line) => {
|
|
36
|
+
* console.log('line', line)
|
|
37
|
+
* ms.push({ line })
|
|
38
|
+
* })
|
|
39
|
+
*
|
|
40
|
+
* let pm = genPm()
|
|
41
|
+
* ev.on('close', () => {
|
|
42
|
+
* console.log('close')
|
|
43
|
+
* pm.resolve()
|
|
44
|
+
* ms.push({ 'close': '' })
|
|
45
|
+
* })
|
|
46
|
+
* await pm
|
|
47
|
+
*
|
|
48
|
+
* fsDeleteFolder(fdt) //刪除臨時任務資料夾
|
|
49
|
+
*
|
|
50
|
+
* console.log('ms', ms)
|
|
51
|
+
* return ms
|
|
52
|
+
* }
|
|
53
|
+
* await test()
|
|
54
|
+
* // ms [
|
|
55
|
+
* // { create: '' },
|
|
56
|
+
* // { line: 'abc' },
|
|
57
|
+
* // { line: '測試中文' },
|
|
58
|
+
* // { line: 'def123xyz' },
|
|
59
|
+
* // { close: '' }
|
|
60
|
+
* // ]
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
function fsBuildReadStreamText(fp) {
|
|
64
|
+
|
|
65
|
+
//check
|
|
66
|
+
if (!fsIsFile(fp)) {
|
|
67
|
+
throw new Error(`fp is not a file`)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//ev
|
|
71
|
+
let ev = evem()
|
|
72
|
+
|
|
73
|
+
//stream
|
|
74
|
+
let stream = fs.createReadStream(fp, { encoding: 'utf8' })
|
|
75
|
+
ev.emit('create')
|
|
76
|
+
|
|
77
|
+
//rl
|
|
78
|
+
let rl = readline.createInterface({
|
|
79
|
+
input: stream,
|
|
80
|
+
crlfDelay: Infinity, //支援\r\n或\n
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
//rl line
|
|
84
|
+
rl.on('line', (line) => {
|
|
85
|
+
// console.log(`line`,line)
|
|
86
|
+
ev.emit('line', line)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// //rl close
|
|
90
|
+
// rl.on('close', () => {
|
|
91
|
+
// // console.log('close')
|
|
92
|
+
// })
|
|
93
|
+
|
|
94
|
+
//stream close
|
|
95
|
+
stream.on('close', () => {
|
|
96
|
+
//stream close事件才代表檔案可刪除
|
|
97
|
+
ev.emit('close')
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
// //stream end
|
|
101
|
+
// stream.on('end', () => {
|
|
102
|
+
// //stream end事件只是讀寫結束, 不代表檔案可刪除
|
|
103
|
+
// })
|
|
104
|
+
|
|
105
|
+
return ev
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export default fsBuildReadStreamText
|
|
@@ -3,12 +3,11 @@ import genPm from './genPm.mjs'
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* 使用stream寫入
|
|
6
|
+
* 使用stream寫入utf8文字至檔案
|
|
7
7
|
*
|
|
8
8
|
* Unit Test: {@link https://github.com/yuda-lyu/wsemi/blob/master/test/fsBuildWriteStreamText.test.mjs Github}
|
|
9
9
|
* @memberOf wsemi
|
|
10
|
-
* @
|
|
11
|
-
* @param {String} c 輸入utf-8文字數據
|
|
10
|
+
* @returns {Object} 回傳函數物件,提供creat、write、end函數,create代表創建stream,可輸入fp為檔案路徑字串,write代表寫入字串,輸入c為字串(預設為行),end代表結束stream,無輸入
|
|
12
11
|
* @example
|
|
13
12
|
* need test in nodejs.
|
|
14
13
|
*
|
|
@@ -86,7 +85,13 @@ function fsBuildWriteStreamText() {
|
|
|
86
85
|
|
|
87
86
|
//end
|
|
88
87
|
let end = () => {
|
|
88
|
+
let pmm = genPm()
|
|
89
|
+
stream.on('close', () => {
|
|
90
|
+
//close事件才代表檔案可刪除
|
|
91
|
+
pmm.resolve()
|
|
92
|
+
})
|
|
89
93
|
stream.end() //發出flush與close
|
|
94
|
+
return pmm
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
//r
|
package/src/index.mjs
CHANGED
|
@@ -55,6 +55,7 @@ export { default as bufReadDbl } from './bufReadDbl.mjs'
|
|
|
55
55
|
export { default as bufWrite } from './bufWrite.mjs'
|
|
56
56
|
export { default as bufWriteDbl } from './bufWriteDbl.mjs'
|
|
57
57
|
export { default as cache } from './cache.mjs'
|
|
58
|
+
export { default as cacheBd } from './cacheBd.mjs'
|
|
58
59
|
export { default as cbol } from './cbol.mjs'
|
|
59
60
|
export { default as cdbl } from './cdbl.mjs'
|
|
60
61
|
export { default as ceil } from './ceil.mjs'
|
|
@@ -142,6 +143,7 @@ export { default as files2data } from './files2data.mjs'
|
|
|
142
143
|
export { default as flattenToConn } from './flattenToConn.mjs'
|
|
143
144
|
export { default as flattenTree } from './flattenTree.mjs'
|
|
144
145
|
export { default as floor } from './floor.mjs'
|
|
146
|
+
export { default as fsBuildReadStreamText } from './fsBuildReadStreamText.mjs'
|
|
145
147
|
export { default as fsBuildWriteStreamText } from './fsBuildWriteStreamText.mjs'
|
|
146
148
|
export { default as fsCleanFolder } from './fsCleanFolder.mjs'
|
|
147
149
|
export { default as fsCleanFolderCore } from './fsCleanFolderCore.mjs'
|
package/src/pmDebounce.mjs
CHANGED
|
@@ -114,47 +114,6 @@ import cint from './cint.mjs'
|
|
|
114
114
|
*/
|
|
115
115
|
function pmDebounce(ms = 300) {
|
|
116
116
|
|
|
117
|
-
// function ClsDebounceEasy(ms) { //簡易法, 因執行階段中無法儲存推入任務會被視為強制取消, 不合需求
|
|
118
|
-
|
|
119
|
-
// //timer
|
|
120
|
-
// let t = null
|
|
121
|
-
|
|
122
|
-
// //pm
|
|
123
|
-
// let pm = Promise.resolve()
|
|
124
|
-
|
|
125
|
-
// //run
|
|
126
|
-
// let run = (func, ...input) => {
|
|
127
|
-
|
|
128
|
-
// //clearTimeout
|
|
129
|
-
// clearTimeout(t)
|
|
130
|
-
|
|
131
|
-
// // console.log('call fun')
|
|
132
|
-
// return new Promise((resolve, reject) => {
|
|
133
|
-
// // console.log('call in Promise', ...input, ms)
|
|
134
|
-
|
|
135
|
-
// //setTimeout
|
|
136
|
-
// t = setTimeout(async () => {
|
|
137
|
-
// // console.log('exec fun start', ...input, ms)
|
|
138
|
-
|
|
139
|
-
// try {
|
|
140
|
-
// let res = func(...input)
|
|
141
|
-
// if (ispm(res)) {
|
|
142
|
-
// res = await pm
|
|
143
|
-
// }
|
|
144
|
-
// resolve(res)
|
|
145
|
-
// }
|
|
146
|
-
// catch (err) {
|
|
147
|
-
// reject(err)
|
|
148
|
-
// }
|
|
149
|
-
// // console.log('exec fun end')
|
|
150
|
-
|
|
151
|
-
// }, ms)
|
|
152
|
-
// })
|
|
153
|
-
// }
|
|
154
|
-
|
|
155
|
-
// return run
|
|
156
|
-
// }
|
|
157
|
-
|
|
158
117
|
function ClsDebounce(ms) {
|
|
159
118
|
let q = [] //queue
|
|
160
119
|
let t = null //timer
|
|
@@ -167,12 +126,6 @@ function pmDebounce(ms = 300) {
|
|
|
167
126
|
}
|
|
168
127
|
ms = cint(ms)
|
|
169
128
|
|
|
170
|
-
// //_tNow
|
|
171
|
-
// let _tNow = Date.now()
|
|
172
|
-
// let getIt = () => {
|
|
173
|
-
// return Date.now() - _tNow
|
|
174
|
-
// }
|
|
175
|
-
|
|
176
129
|
function detect() {
|
|
177
130
|
|
|
178
131
|
//check
|