wsemi 1.7.21 → 1.7.23
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 +1 -1
- package/dist/wsemi.umd.js +3 -3
- package/dist/wsemi.umd.js.map +1 -1
- package/docs/-_class.mjs.html +1 -1
- package/docs/ab2blob.mjs.html +1 -1
- package/docs/ab2u8arr.mjs.html +1 -1
- package/docs/addExcelWorksheetFromData.mjs.html +1 -1
- package/docs/addMonth.mjs.html +1 -1
- package/docs/aes2str.mjs.html +1 -1
- package/docs/alive.mjs.html +1 -1
- package/docs/arr2dt.mjs.html +1 -1
- package/docs/arrAccum.mjs.html +1 -1
- package/docs/arrAdd.mjs.html +1 -1
- package/docs/arrAt.mjs.html +1 -1
- package/docs/arrDiff.mjs.html +1 -1
- package/docs/arrFilterByKeywords.mjs.html +1 -1
- package/docs/arrFilterByNum.mjs.html +1 -1
- package/docs/arrFilterByPnum.mjs.html +1 -1
- package/docs/arrFilterByPnumAndToLog.mjs.html +1 -1
- package/docs/arrFind.mjs.html +1 -1
- package/docs/arrGroupByMaxmin.mjs.html +1 -1
- package/docs/arrHas.mjs.html +1 -1
- package/docs/arrInsert.mjs.html +1 -1
- package/docs/arrLookupByMaxmin.mjs.html +1 -1
- package/docs/arrMax.mjs.html +1 -1
- package/docs/arrMin.mjs.html +1 -1
- package/docs/arrMulti.mjs.html +1 -1
- package/docs/arrNorm.mjs.html +1 -1
- package/docs/arrProduct.mjs.html +1 -1
- package/docs/arrReduce.mjs.html +1 -1
- package/docs/arrSep.mjs.html +1 -1
- package/docs/arrSort.mjs.html +1 -1
- package/docs/asind.mjs.html +1 -1
- package/docs/atan2d.mjs.html +1 -1
- package/docs/atand.mjs.html +1 -1
- package/docs/attstr.mjs.html +403 -331
- package/docs/b642obj.mjs.html +1 -1
- package/docs/b642str.mjs.html +1 -1
- package/docs/b642u16arr.mjs.html +1 -1
- package/docs/b642u8arr.mjs.html +1 -1
- package/docs/binstr.mjs.html +1 -1
- package/docs/blob2ab.mjs.html +1 -1
- package/docs/blob2b64.mjs.html +1 -1
- package/docs/blob2str.mjs.html +1 -1
- package/docs/blob2u8arr.mjs.html +1 -1
- package/docs/blobs2b64s.mjs.html +1 -1
- package/docs/blobs2u8arrs.mjs.html +1 -1
- package/docs/bodyLog.mjs.html +1 -1
- package/docs/browserView.mjs.html +1 -1
- package/docs/browserViewFromBlob.mjs.html +1 -1
- package/docs/browserViewFromText.mjs.html +1 -1
- package/docs/browserViewFromU8arr.mjs.html +1 -1
- package/docs/bs2u8arr.mjs.html +1 -1
- package/docs/bufRead.mjs.html +1 -1
- package/docs/bufReadDbl.mjs.html +1 -1
- package/docs/bufWrite.mjs.html +1 -1
- package/docs/bufWriteDbl.mjs.html +1 -1
- package/docs/cache.mjs.html +1 -1
- package/docs/cbol.mjs.html +1 -1
- package/docs/cdbl.mjs.html +1 -1
- package/docs/cfilesize.mjs.html +1 -1
- package/docs/cfinancial.mjs.html +1 -1
- package/docs/cint.mjs.html +1 -1
- package/docs/clearXSS.mjs.html +1 -1
- package/docs/color.mjs.html +1 -1
- package/docs/composeToTree.mjs.html +1 -1
- package/docs/convertToTree.mjs.html +1 -1
- package/docs/copyStrToClipboard.mjs.html +1 -1
- package/docs/cosd.mjs.html +1 -1
- package/docs/cotd.mjs.html +1 -1
- package/docs/createExcelWorkbook.mjs.html +1 -1
- package/docs/cscd.mjs.html +1 -1
- package/docs/cstr.mjs.html +1 -1
- package/docs/day2cht.mjs.html +1 -1
- package/docs/debounce.mjs.html +1 -1
- package/docs/delay.mjs.html +1 -1
- package/docs/dig.mjs.html +1 -1
- package/docs/digExp.mjs.html +1 -1
- package/docs/domAlert.mjs.html +1 -1
- package/docs/domAppend.mjs.html +1 -1
- package/docs/domCancelEvent.mjs.html +1 -1
- package/docs/domCompareText.mjs.html +1 -1
- package/docs/domCompareTextDyn.mjs.html +1 -1
- package/docs/domConvertToPic.mjs.html +1 -1
- package/docs/domConvertToPicDyn.mjs.html +1 -1
- package/docs/domDetect.mjs.html +1 -1
- package/docs/domDrag.mjs.html +1 -1
- package/docs/domDragBarAndScroll.mjs.html +1 -1
- package/docs/domDragPreview.mjs.html +1 -1
- package/docs/domDropFiles.mjs.html +1 -1
- package/docs/domElementsFromPoint.mjs.html +1 -1
- package/docs/domFadeIn.mjs.html +1 -1
- package/docs/domFadeOut.mjs.html +1 -1
- package/docs/domFind.mjs.html +1 -1
- package/docs/domFinds.mjs.html +1 -1
- package/docs/domGetAttr.mjs.html +1 -1
- package/docs/domGetBoudRect.mjs.html +1 -1
- package/docs/domGetBoudRectRefSelf.mjs.html +1 -1
- package/docs/domGetFileAccept.mjs.html +1 -1
- package/docs/domGetFiles.mjs.html +1 -1
- package/docs/domGetParents.mjs.html +1 -1
- package/docs/domGetPointFromEvent.mjs.html +1 -1
- package/docs/domGetScrollableParent.mjs.html +1 -1
- package/docs/domGetWindowSize.mjs.html +1 -1
- package/docs/domIsClientXYIn.mjs.html +1 -1
- package/docs/domIsFocused.mjs.html +1 -1
- package/docs/domIsVisible.mjs.html +1 -1
- package/docs/domPrepend.mjs.html +1 -1
- package/docs/domRemove.mjs.html +1 -1
- package/docs/domRenderMarkdownMind.mjs.html +1 -1
- package/docs/domRenderMarkdownMindDyn.mjs.html +1 -1
- package/docs/domRipple.mjs.html +1 -1
- package/docs/domScrollIntoView.mjs.html +1 -1
- package/docs/domScrollTo.mjs.html +1 -1
- package/docs/domShowImages.mjs.html +1 -1
- package/docs/domShowImagesDyn.mjs.html +1 -1
- package/docs/domShowInputAndGetFiles.mjs.html +1 -1
- package/docs/domShowInputAndGetFilesU8Arrs.mjs.html +1 -1
- package/docs/domTooltip.mjs.html +1 -1
- package/docs/domTriggerEvent.mjs.html +1 -1
- package/docs/domVirtualCreate.mjs.html +1 -1
- package/docs/domVirtualCreateQueue.mjs.html +1 -1
- package/docs/downloadExcelFileFromData.mjs.html +1 -1
- package/docs/downloadExcelFileFromDataDyn.mjs.html +1 -1
- package/docs/downloadFileFromB64.mjs.html +1 -1
- package/docs/downloadFileFromBlob.mjs.html +1 -1
- package/docs/downloadFileFromText.mjs.html +1 -1
- package/docs/downloadFileFromU8Arr.mjs.html +1 -1
- package/docs/dtmapping.mjs.html +1 -1
- package/docs/dtpick.mjs.html +1 -1
- package/docs/evem.mjs.html +1 -1
- package/docs/examples/ex-blob2b64.html +1 -1
- package/docs/examples/ex-clearXSS.html +1 -1
- package/docs/examples/ex-colorConverter.html +1 -1
- package/docs/examples/ex-cryptojs.html +1 -1
- package/docs/examples/ex-dayjs.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-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-lodash.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-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 +1 -1
- package/docs/execScript.mjs.html +1 -1
- package/docs/f2c.mjs.html +1 -1
- package/docs/filepathToTree.mjs.html +1 -1
- package/docs/files2data.mjs.html +1 -1
- package/docs/flattenToConn.mjs.html +1 -1
- package/docs/flattenTree.mjs.html +1 -1
- package/docs/fsCleanFolder.mjs.html +1 -1
- package/docs/fsCopyFolder.mjs.html +1 -1
- package/docs/fsCreateFile.mjs.html +1 -1
- package/docs/fsCreateFolder.mjs.html +1 -1
- package/docs/fsDeleteFile.mjs.html +1 -1
- package/docs/fsDeleteFolder.mjs.html +1 -1
- package/docs/fsEvem.mjs.html +1 -1
- package/docs/fsGetFilesInFolder.mjs.html +1 -1
- package/docs/fsGetFoldersInFolder.mjs.html +1 -1
- package/docs/fsIsFile.mjs.html +1 -1
- package/docs/fsIsFolder.mjs.html +1 -1
- package/docs/fsReadText.mjs.html +1 -1
- package/docs/fsRenameFile.mjs.html +1 -1
- package/docs/fsRenameFolder.mjs.html +1 -1
- package/docs/fsTreeFolder.mjs.html +1 -1
- package/docs/fsWatchFile.mjs.html +1 -1
- package/docs/fsWriteText.mjs.html +1 -1
- package/docs/genGradientColor.mjs.html +1 -1
- package/docs/genID.mjs.html +1 -1
- package/docs/genPm.mjs.html +1 -1
- package/docs/getBufferSize.mjs.html +1 -1
- package/docs/getClearPathName.mjs.html +1 -1
- package/docs/getCsvStrFromData.mjs.html +1 -1
- package/docs/getDataFromExcelFileU8Arr.mjs.html +1 -1
- package/docs/getDataFromExcelFileU8ArrDyn.mjs.html +1 -1
- package/docs/getDirName.mjs.html +1 -1
- package/docs/getEnv.mjs.html +1 -1
- package/docs/getExcelU8ArrFromData.mjs.html +1 -1
- package/docs/getExcelU8ArrFromWorkbook.mjs.html +1 -1
- package/docs/getExcelWorkbookFromData.mjs.html +1 -1
- package/docs/getExcelWorkbookFromWorksheet.mjs.html +1 -1
- package/docs/getExcelWorksheetFromData.mjs.html +1 -1
- package/docs/getFileAccept.mjs.html +1 -1
- package/docs/getFileName.mjs.html +1 -1
- package/docs/getFileTrueName.mjs.html +1 -1
- package/docs/getGlobal.mjs.html +1 -1
- package/docs/getObjSize.mjs.html +1 -1
- package/docs/getTimeBetween.mjs.html +1 -1
- package/docs/getTimeFromUnit.mjs.html +1 -1
- package/docs/getTimeObject.mjs.html +1 -1
- package/docs/getTimeRange.mjs.html +1 -1
- package/docs/getUserAgent.mjs.html +1 -1
- package/docs/getUserAgentDyn.mjs.html +1 -1
- package/docs/getltdtkeys.mjs.html +1 -1
- package/docs/haskey.mjs.html +1 -1
- package/docs/html2pic.mjs.html +1 -1
- package/docs/html2picDyn.mjs.html +1 -1
- package/docs/html2str.mjs.html +1 -1
- package/docs/html2strDyn.mjs.html +1 -1
- package/docs/htmlDecode.mjs.html +1 -1
- package/docs/htmlEncode.mjs.html +1 -1
- package/docs/importResources.mjs.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interp1.mjs.html +1 -1
- package/docs/isDev.mjs.html +1 -1
- package/docs/isEle.mjs.html +1 -1
- package/docs/isEleExistByID.mjs.html +1 -1
- package/docs/isEmail.mjs.html +1 -1
- package/docs/isIE.mjs.html +1 -1
- package/docs/isNarrow.mjs.html +1 -1
- package/docs/isStrHasCapital.mjs.html +1 -1
- package/docs/isStrHasLowerCase.mjs.html +1 -1
- package/docs/isStrHasNumber.mjs.html +1 -1
- package/docs/isUserIdentify.mjs.html +1 -1
- package/docs/isUserName.mjs.html +1 -1
- package/docs/isUserPW.mjs.html +1 -1
- package/docs/isWindow.mjs.html +1 -1
- package/docs/isab.mjs.html +1 -1
- package/docs/isarr.mjs.html +1 -1
- package/docs/isarr0.mjs.html +1 -1
- package/docs/isblob.mjs.html +1 -1
- package/docs/isbol.mjs.html +1 -1
- package/docs/isday.mjs.html +1 -1
- package/docs/isearr.mjs.html +1 -1
- package/docs/iseobj.mjs.html +1 -1
- package/docs/iser.mjs.html +1 -1
- package/docs/isernot.mjs.html +1 -1
- package/docs/isestr.mjs.html +1 -1
- package/docs/isfun.mjs.html +1 -1
- package/docs/isint.mjs.html +1 -1
- package/docs/ismonth.mjs.html +1 -1
- package/docs/isn0int.mjs.html +1 -1
- package/docs/isn0num.mjs.html +1 -1
- package/docs/isnbr.mjs.html +1 -1
- package/docs/isnint.mjs.html +1 -1
- package/docs/isnnum.mjs.html +1 -1
- package/docs/isnull.mjs.html +1 -1
- package/docs/isnum.mjs.html +1 -1
- package/docs/isobj.mjs.html +1 -1
- package/docs/isobj0.mjs.html +1 -1
- package/docs/isp0int.mjs.html +1 -1
- package/docs/isp0num.mjs.html +1 -1
- package/docs/ispint.mjs.html +1 -1
- package/docs/ispm.mjs.html +1 -1
- package/docs/ispnum.mjs.html +1 -1
- package/docs/isstr.mjs.html +1 -1
- package/docs/isstr0.mjs.html +1 -1
- package/docs/istime.mjs.html +1 -1
- package/docs/istimeTZ.mjs.html +1 -1
- package/docs/istimems.mjs.html +1 -1
- package/docs/istimemsTZ.mjs.html +1 -1
- package/docs/isu16arr.mjs.html +1 -1
- package/docs/isu8arr.mjs.html +1 -1
- package/docs/isundefined.mjs.html +1 -1
- package/docs/j2o.mjs.html +1 -1
- package/docs/keysmat2ltdt.mjs.html +1 -1
- package/docs/log.mjs.html +1 -1
- package/docs/ltdt2vrtsable.mjs.html +1 -1
- package/docs/ltdtDiff.mjs.html +1 -1
- package/docs/ltdtDiffByKey.mjs.html +1 -1
- package/docs/ltdtkeys2mat.mjs.html +1 -1
- package/docs/ltdtkeysheads2mat.mjs.html +1 -1
- package/docs/ltdtmapping.mjs.html +1 -1
- package/docs/ltdtmerge.mjs.html +1 -1
- package/docs/ltdtpick.mjs.html +1 -1
- package/docs/ltdtpull.mjs.html +1 -1
- package/docs/mat2ltdt.mjs.html +1 -1
- package/docs/matConcat.mjs.html +1 -1
- package/docs/matDiff.mjs.html +1 -1
- package/docs/matat.mjs.html +1 -1
- package/docs/now2str.mjs.html +1 -1
- package/docs/now2strp.mjs.html +1 -1
- package/docs/nowDay2str.mjs.html +1 -1
- package/docs/nowms2str.mjs.html +1 -1
- package/docs/nowms2strp.mjs.html +1 -1
- package/docs/o2j.mjs.html +1 -1
- package/docs/obj2b64.mjs.html +1 -1
- package/docs/obj2pb64.mjs.html +1 -1
- package/docs/obj2str.mjs.html +1 -1
- package/docs/obj2stru8arr.mjs.html +1 -1
- package/docs/obj2u8arr.mjs.html +1 -1
- package/docs/objSortBy.mjs.html +1 -1
- package/docs/objSortByKeys.mjs.html +1 -1
- package/docs/ocr.mjs.html +1 -1
- package/docs/ocrDyn.mjs.html +1 -1
- package/docs/oo.mjs.html +1 -1
- package/docs/openLink.mjs.html +1 -1
- package/docs/pb642obj.mjs.html +1 -1
- package/docs/pmChain.mjs.html +1 -1
- package/docs/pmConvertResolve.mjs.html +1 -1
- package/docs/pmHook.mjs.html +1 -1
- package/docs/pmHookReject.mjs.html +1 -1
- package/docs/pmIni.mjs.html +1 -1
- package/docs/pmInvResolve.mjs.html +1 -1
- package/docs/pmMap.mjs.html +1 -1
- package/docs/pmQueue.mjs.html +1 -1
- package/docs/pmSeries.mjs.html +1 -1
- package/docs/pmThrottle.mjs.html +1 -1
- package/docs/pseudoRandom.mjs.html +1 -1
- package/docs/pseudoRandomIntRange.mjs.html +1 -1
- package/docs/pseudoRandomRange.mjs.html +1 -1
- package/docs/queue.mjs.html +1 -1
- package/docs/rang.mjs.html +1 -1
- package/docs/rep.mjs.html +1 -1
- package/docs/repObj.mjs.html +1 -1
- package/docs/replace.mjs.html +1 -1
- package/docs/replaceObj.mjs.html +1 -1
- package/docs/replacePlus.mjs.html +1 -1
- package/docs/round.mjs.html +1 -1
- package/docs/secd.mjs.html +1 -1
- package/docs/sep.mjs.html +1 -1
- package/docs/sepInt.mjs.html +1 -1
- package/docs/sind.mjs.html +1 -1
- package/docs/split.mjs.html +1 -1
- package/docs/str2aes.mjs.html +1 -1
- package/docs/str2b64.mjs.html +1 -1
- package/docs/str2hint.mjs.html +1 -1
- package/docs/str2md5.mjs.html +1 -1
- package/docs/str2obj.mjs.html +1 -1
- package/docs/str2sha512.mjs.html +1 -1
- package/docs/str2u8arr.mjs.html +1 -1
- package/docs/strCompare.mjs.html +1 -1
- package/docs/strDiff.mjs.html +1 -1
- package/docs/strFindFuzz.mjs.html +1 -1
- package/docs/strFindFuzzDyn.mjs.html +1 -1
- package/docs/strFindSimilar.mjs.html +1 -1
- package/docs/strdelleft.mjs.html +1 -1
- package/docs/strdelright.mjs.html +1 -1
- package/docs/strleft.mjs.html +1 -1
- package/docs/strmid.mjs.html +1 -1
- package/docs/strright.mjs.html +1 -1
- package/docs/stru8arr2obj.mjs.html +1 -1
- package/docs/tand.mjs.html +1 -1
- package/docs/time2day.mjs.html +1 -1
- package/docs/time2hour.mjs.html +1 -1
- package/docs/time2min.mjs.html +1 -1
- package/docs/timeTZ2day.mjs.html +1 -1
- package/docs/timeTZ2expire.mjs.html +1 -1
- package/docs/timeTZ2hour.mjs.html +1 -1
- package/docs/timeTZ2min.mjs.html +1 -1
- package/docs/timeTZ2past.mjs.html +1 -1
- package/docs/timems2day.mjs.html +1 -1
- package/docs/timems2hour.mjs.html +1 -1
- package/docs/timems2min.mjs.html +1 -1
- package/docs/timems2time.mjs.html +1 -1
- package/docs/timemsTZ2day.mjs.html +1 -1
- package/docs/timemsTZ2expire.mjs.html +1 -1
- package/docs/timemsTZ2hour.mjs.html +1 -1
- package/docs/timemsTZ2min.mjs.html +1 -1
- package/docs/timemsTZ2past.mjs.html +1 -1
- package/docs/timemsTZ2time.mjs.html +1 -1
- package/docs/treeObj.mjs.html +1 -1
- package/docs/treeToFilepath.mjs.html +1 -1
- package/docs/trim.mjs.html +1 -1
- package/docs/u16arr2b64.mjs.html +1 -1
- package/docs/u16arr2u8arr.mjs.html +1 -1
- package/docs/u8arr2ab.mjs.html +1 -1
- package/docs/u8arr2b64.mjs.html +1 -1
- package/docs/u8arr2blob.mjs.html +1 -1
- package/docs/u8arr2bs.mjs.html +1 -1
- package/docs/u8arr2obj.mjs.html +1 -1
- package/docs/u8arr2str.mjs.html +1 -1
- package/docs/u8arr2u16arr.mjs.html +1 -1
- package/docs/urlParse.mjs.html +1 -1
- package/docs/verifyValue.mjs.html +1 -1
- package/docs/waitFun.mjs.html +1 -1
- package/docs/wsemi.html +16 -4
- package/g.mjs +269 -258
- package/package.json +1 -1
- package/src/attstr.mjs +402 -330
- package/test/attstr.test.mjs +95 -89
package/src/attstr.mjs
CHANGED
|
@@ -5,340 +5,15 @@ import size from 'lodash/size'
|
|
|
5
5
|
import each from 'lodash/each'
|
|
6
6
|
import filter from 'lodash/filter'
|
|
7
7
|
import join from 'lodash/join'
|
|
8
|
+
import drop from 'lodash/drop'
|
|
8
9
|
import sep from './sep.mjs'
|
|
10
|
+
import isarr from './isarr.mjs'
|
|
9
11
|
import isearr from './isearr.mjs'
|
|
12
|
+
import isstr from './isstr.mjs'
|
|
10
13
|
import isestr from './isestr.mjs'
|
|
11
14
|
import arrHas from './arrHas.mjs'
|
|
12
15
|
|
|
13
16
|
|
|
14
|
-
function sepItems(composItems) {
|
|
15
|
-
|
|
16
|
-
//check
|
|
17
|
-
if (!isestr(composItems)) {
|
|
18
|
-
return []
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//arrItems
|
|
22
|
-
let arrItems = sep(composItems, ';')
|
|
23
|
-
|
|
24
|
-
//uniq
|
|
25
|
-
arrItems = uniq(arrItems)
|
|
26
|
-
|
|
27
|
-
return arrItems
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
function joinItems(arrItems) {
|
|
32
|
-
|
|
33
|
-
//check
|
|
34
|
-
if (!isearr(arrItems)) {
|
|
35
|
-
return ''
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//uniq
|
|
39
|
-
arrItems = uniq(arrItems)
|
|
40
|
-
|
|
41
|
-
//str
|
|
42
|
-
let str = join(arrItems, ';')
|
|
43
|
-
|
|
44
|
-
return str
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function atItemsMergeS1(its) {
|
|
49
|
-
|
|
50
|
-
//filter
|
|
51
|
-
its = filter(its, isestr)
|
|
52
|
-
|
|
53
|
-
//uniq
|
|
54
|
-
its = uniq(its)
|
|
55
|
-
|
|
56
|
-
return joinItems(its)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function atItemsMergeS2(its) {
|
|
61
|
-
|
|
62
|
-
//itsTemp
|
|
63
|
-
let itsTemp = []
|
|
64
|
-
each(its, (v) => {
|
|
65
|
-
let table = get(v, 'table', '')
|
|
66
|
-
let id = get(v, 'id', '')
|
|
67
|
-
if (trim(table) === '') {
|
|
68
|
-
console.log('atItemsMergeS2: invalid table in its', v, its)
|
|
69
|
-
}
|
|
70
|
-
else if (trim(id) === '') {
|
|
71
|
-
console.log('atItemsMergeS2: invalid id in its', v, its)
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
itsTemp.push(`${table}@${id}`)
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
//itsTemp
|
|
79
|
-
its = joinItems(itsTemp)
|
|
80
|
-
|
|
81
|
-
return its
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
function atJoin(its) {
|
|
86
|
-
|
|
87
|
-
//check
|
|
88
|
-
if (!isearr(its)) {
|
|
89
|
-
return ''
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
//it0
|
|
93
|
-
let it0 = get(its, 0)
|
|
94
|
-
|
|
95
|
-
//mode
|
|
96
|
-
let table = trim(get(it0, 'table', ''))
|
|
97
|
-
let id = trim(get(it0, 'id', ''))
|
|
98
|
-
let mode = '1p'
|
|
99
|
-
if (isestr(table) && isestr(id)) {
|
|
100
|
-
mode = '2p'
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (mode === '1p') {
|
|
104
|
-
return atItemsMergeS1(its)
|
|
105
|
-
}
|
|
106
|
-
else if (mode === '2p') {
|
|
107
|
-
return atItemsMergeS2(its)
|
|
108
|
-
}
|
|
109
|
-
return ''
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
function atParseS1(composItems) {
|
|
114
|
-
|
|
115
|
-
//check
|
|
116
|
-
if (!isestr(composItems)) {
|
|
117
|
-
return []
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
//arrItems
|
|
121
|
-
let arrItems = sepItems(composItems)
|
|
122
|
-
|
|
123
|
-
//ids
|
|
124
|
-
let ids = filter(arrItems, isestr)
|
|
125
|
-
|
|
126
|
-
return ids
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
function atParseS2(composItems) {
|
|
131
|
-
|
|
132
|
-
//check
|
|
133
|
-
if (!isestr(composItems)) {
|
|
134
|
-
return []
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//arrItems
|
|
138
|
-
let arrItems = sepItems(composItems)
|
|
139
|
-
|
|
140
|
-
//ids
|
|
141
|
-
let ids = []
|
|
142
|
-
each(arrItems, (v) => {
|
|
143
|
-
let s = sep(v, '@')
|
|
144
|
-
let table = get(s, 0, '')
|
|
145
|
-
let id = get(s, 1, '')
|
|
146
|
-
if (table === '') {
|
|
147
|
-
console.log('atParseS2: invalid table in composItems', v, composItems)
|
|
148
|
-
}
|
|
149
|
-
else if (id === '') {
|
|
150
|
-
console.log('atParseS2: invalid id in composItems', v, composItems)
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
ids.push({
|
|
154
|
-
item: v,
|
|
155
|
-
table,
|
|
156
|
-
id,
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
return ids
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
function atParse(composItems, opt = {}) {
|
|
166
|
-
|
|
167
|
-
//check
|
|
168
|
-
if (!isestr(composItems)) {
|
|
169
|
-
return []
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
//mode
|
|
173
|
-
let mode = get(opt, 'mode')
|
|
174
|
-
if (mode !== '1p' && mode !== '2p') {
|
|
175
|
-
mode = 'auto'
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
//mode
|
|
179
|
-
if (mode === '1p') {
|
|
180
|
-
return atParseS1(composItems)
|
|
181
|
-
}
|
|
182
|
-
else if (mode === '2p') {
|
|
183
|
-
return atParseS2(composItems)
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
//indexOf
|
|
187
|
-
let bc = composItems.indexOf('@') >= 0
|
|
188
|
-
|
|
189
|
-
if (bc) {
|
|
190
|
-
return atParseS2(composItems)
|
|
191
|
-
}
|
|
192
|
-
return atParseS1(composItems)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
function atAddS1(composItems1, composItems2) {
|
|
197
|
-
|
|
198
|
-
//atParseS1
|
|
199
|
-
let itp1 = atParseS1(composItems1)
|
|
200
|
-
let itp2 = atParseS1(composItems2)
|
|
201
|
-
|
|
202
|
-
//its
|
|
203
|
-
let its = [...itp1, ...itp2]
|
|
204
|
-
|
|
205
|
-
//check
|
|
206
|
-
if (size(its) === 0) {
|
|
207
|
-
return ''
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return atItemsMergeS1(its)
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
function atAddS2(composItems1, composItems2) {
|
|
215
|
-
|
|
216
|
-
//atParseS2
|
|
217
|
-
let itp1 = atParseS2(composItems1)
|
|
218
|
-
let itp2 = atParseS2(composItems2)
|
|
219
|
-
|
|
220
|
-
//its
|
|
221
|
-
let its = [...itp1, ...itp2]
|
|
222
|
-
|
|
223
|
-
//check
|
|
224
|
-
if (size(its) === 0) {
|
|
225
|
-
return ''
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return atItemsMergeS2(its)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
function atAdd(composItems1, composItems2, opt = {}) {
|
|
233
|
-
|
|
234
|
-
//mode
|
|
235
|
-
let mode = get(opt, 'mode')
|
|
236
|
-
if (mode !== '1p' && mode !== '2p') {
|
|
237
|
-
mode = 'auto'
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
//mode
|
|
241
|
-
if (mode === '1p') {
|
|
242
|
-
atAddS1(composItems1, composItems2)
|
|
243
|
-
}
|
|
244
|
-
else if (mode === '2p') {
|
|
245
|
-
return atAddS2(composItems1, composItems2)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
//indexOf
|
|
249
|
-
let bc1 = composItems1.indexOf('@') >= 0
|
|
250
|
-
let bc2 = composItems2.indexOf('@') >= 0
|
|
251
|
-
|
|
252
|
-
if (bc1 || bc2) {
|
|
253
|
-
return atAddS2(composItems1, composItems2)
|
|
254
|
-
}
|
|
255
|
-
return atAddS1(composItems1, composItems2)
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
function atRemoveS1(composItems1, composItems2) {
|
|
260
|
-
|
|
261
|
-
//atParseS1
|
|
262
|
-
let itp1 = atParseS1(composItems1)
|
|
263
|
-
let itp2 = atParseS1(composItems2)
|
|
264
|
-
|
|
265
|
-
//its
|
|
266
|
-
let its = []
|
|
267
|
-
each(itp1, (v) => {
|
|
268
|
-
if (!arrHas(v, itp2)) {
|
|
269
|
-
its.push(v)
|
|
270
|
-
}
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
//check
|
|
274
|
-
if (size(its) === 0) {
|
|
275
|
-
return ''
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return atItemsMergeS1(its)
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
function atRemoveS2(composItems1, composItems2) {
|
|
283
|
-
|
|
284
|
-
//atParseS2
|
|
285
|
-
let itp1 = atParseS2(composItems1)
|
|
286
|
-
let itp2 = atParseS2(composItems2)
|
|
287
|
-
|
|
288
|
-
//its
|
|
289
|
-
let its = []
|
|
290
|
-
each(itp1, (v) => {
|
|
291
|
-
if (!arrHas(v, itp2)) {
|
|
292
|
-
its.push(v)
|
|
293
|
-
}
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
//check
|
|
297
|
-
if (size(its) === 0) {
|
|
298
|
-
return ''
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return atItemsMergeS2(its)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
function atRemove(composItems, removeItemOrId, opt = {}) {
|
|
306
|
-
|
|
307
|
-
//check composItems
|
|
308
|
-
if (!isestr(composItems)) {
|
|
309
|
-
return ''
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
//check removeItemOrId
|
|
313
|
-
if (!isestr(removeItemOrId)) {
|
|
314
|
-
return composItems
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
//mode
|
|
318
|
-
let mode = get(opt, 'mode')
|
|
319
|
-
if (mode !== '1p' && mode !== '2p') {
|
|
320
|
-
mode = 'auto'
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
//mode
|
|
324
|
-
if (mode === '1p') {
|
|
325
|
-
return atRemoveS1(composItems, removeItemOrId)
|
|
326
|
-
}
|
|
327
|
-
else if (mode === '2p') {
|
|
328
|
-
return atRemoveS2(composItems, removeItemOrId)
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
//indexOf
|
|
332
|
-
// let bc = composItems.indexOf('@') >= 0
|
|
333
|
-
let bt = removeItemOrId.indexOf('@') >= 0
|
|
334
|
-
|
|
335
|
-
if (bt) { //bc可為空字串故不一定有@
|
|
336
|
-
return atRemoveS2(composItems, removeItemOrId)
|
|
337
|
-
}
|
|
338
|
-
return atRemoveS1(composItems, removeItemOrId)
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
17
|
/**
|
|
343
18
|
* 屬性字串處理
|
|
344
19
|
*
|
|
@@ -352,6 +27,8 @@ function atRemove(composItems, removeItemOrId, opt = {}) {
|
|
|
352
27
|
* let c2
|
|
353
28
|
* let r
|
|
354
29
|
*
|
|
30
|
+
* let at = attstr()
|
|
31
|
+
*
|
|
355
32
|
* //parse
|
|
356
33
|
* console.log('parse')
|
|
357
34
|
*
|
|
@@ -612,16 +289,411 @@ function atRemove(composItems, removeItemOrId, opt = {}) {
|
|
|
612
289
|
* console.log(r)
|
|
613
290
|
* // => ''
|
|
614
291
|
*
|
|
292
|
+
* let at2 = attstr({ dlmItem: ',', dlmSep: '|' })
|
|
293
|
+
*
|
|
294
|
+
* c = 'x1|abc@123|def@456,x2|ghi@789'
|
|
295
|
+
* r = at2.parse(c)
|
|
296
|
+
* console.log(r)
|
|
297
|
+
* // => [
|
|
298
|
+
* // { item: 'x1|abc@123|def@456', table: 'x1', id: ['abc@123','def@456'] },
|
|
299
|
+
* // { item: 'x2|ghi@789', table: 'x2', id: 'ghi@789' }
|
|
300
|
+
* // ]
|
|
301
|
+
*
|
|
615
302
|
*/
|
|
616
|
-
function attstr() {
|
|
303
|
+
function attstr(opt = {}) {
|
|
304
|
+
let dlmItem = ';'
|
|
305
|
+
let dlmSep = '@'
|
|
306
|
+
let keyTable = 'table'
|
|
307
|
+
let keyId = 'id'
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
//dlmItem
|
|
311
|
+
let _dlmItem = get(opt, 'dlmItem', '')
|
|
312
|
+
if (isestr(_dlmItem)) {
|
|
313
|
+
dlmItem = _dlmItem
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
//dlmSep
|
|
318
|
+
let _dlmSep = get(opt, 'dlmSep', '')
|
|
319
|
+
if (isestr(_dlmSep)) {
|
|
320
|
+
dlmSep = _dlmSep
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
//keyTable
|
|
325
|
+
let _keyTable = get(opt, 'keyTable', '')
|
|
326
|
+
if (isestr(_keyTable)) {
|
|
327
|
+
keyTable = _keyTable
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
//keyId
|
|
332
|
+
let _keyId = get(opt, 'keyId', '')
|
|
333
|
+
if (isestr(_keyId)) {
|
|
334
|
+
keyId = _keyId
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
function sepItems(composItems) {
|
|
339
|
+
|
|
340
|
+
//check
|
|
341
|
+
if (!isestr(composItems)) {
|
|
342
|
+
return []
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
//arrItems
|
|
346
|
+
let arrItems = sep(composItems, dlmItem)
|
|
347
|
+
|
|
348
|
+
//uniq
|
|
349
|
+
arrItems = uniq(arrItems)
|
|
350
|
+
|
|
351
|
+
return arrItems
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
function joinItems(arrItems) {
|
|
356
|
+
|
|
357
|
+
//check
|
|
358
|
+
if (!isearr(arrItems)) {
|
|
359
|
+
return ''
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
//uniq
|
|
363
|
+
arrItems = uniq(arrItems)
|
|
364
|
+
|
|
365
|
+
//str
|
|
366
|
+
let str = join(arrItems, dlmItem)
|
|
367
|
+
|
|
368
|
+
return str
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
function atItemsMergeS1(its) {
|
|
373
|
+
|
|
374
|
+
//filter
|
|
375
|
+
its = filter(its, isestr)
|
|
376
|
+
|
|
377
|
+
//uniq
|
|
378
|
+
its = uniq(its)
|
|
379
|
+
|
|
380
|
+
return joinItems(its)
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
function atItemsMergeS2(its) {
|
|
385
|
+
|
|
386
|
+
//itsTemp
|
|
387
|
+
let itsTemp = []
|
|
388
|
+
each(its, (v) => {
|
|
389
|
+
let table = get(v, keyTable, '')
|
|
390
|
+
console.log('table', table)
|
|
391
|
+
let id = get(v, keyId, '')
|
|
392
|
+
console.log('id', id)
|
|
393
|
+
if (!isestr(table)) {
|
|
394
|
+
console.log(`atItemsMergeS2: invalid keyTable[${keyTable}] in its`, v, its)
|
|
395
|
+
}
|
|
396
|
+
if (isstr(id)) {
|
|
397
|
+
if (id === '') {
|
|
398
|
+
console.log(`atItemsMergeS2: invalid keyId[${keyId}] in its`, v, its)
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else if (isarr(id)) {
|
|
402
|
+
if (size(id) === 0) {
|
|
403
|
+
console.log(`atItemsMergeS2: invalid keyId[${keyId}] in its`, v, its)
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
console.log(`atItemsMergeS2: keyId[${keyId}] is not a string or an array in its`, v, its)
|
|
408
|
+
}
|
|
409
|
+
if (isstr(id)) {
|
|
410
|
+
itsTemp.push(`${table}${dlmSep}${id}`)
|
|
411
|
+
}
|
|
412
|
+
else if (isarr(id)) {
|
|
413
|
+
let ids = join(id, dlmSep)
|
|
414
|
+
itsTemp.push(`${table}${dlmSep}${ids}`)
|
|
415
|
+
}
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
//itsTemp
|
|
419
|
+
its = joinItems(itsTemp)
|
|
420
|
+
|
|
421
|
+
return its
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
function atJoin(its) {
|
|
426
|
+
|
|
427
|
+
//check
|
|
428
|
+
if (!isearr(its)) {
|
|
429
|
+
return ''
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
//it0
|
|
433
|
+
let it0 = get(its, 0)
|
|
434
|
+
|
|
435
|
+
//mode
|
|
436
|
+
let table = trim(get(it0, keyTable, ''))
|
|
437
|
+
let id = trim(get(it0, keyId, ''))
|
|
438
|
+
let mode = '1p'
|
|
439
|
+
if (isestr(table) && isestr(id)) {
|
|
440
|
+
mode = '2p'
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (mode === '1p') {
|
|
444
|
+
return atItemsMergeS1(its)
|
|
445
|
+
}
|
|
446
|
+
else if (mode === '2p') {
|
|
447
|
+
return atItemsMergeS2(its)
|
|
448
|
+
}
|
|
449
|
+
return ''
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
function atParseS1(composItems) {
|
|
454
|
+
|
|
455
|
+
//check
|
|
456
|
+
if (!isestr(composItems)) {
|
|
457
|
+
return []
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
//arrItems
|
|
461
|
+
let arrItems = sepItems(composItems)
|
|
462
|
+
|
|
463
|
+
//ids
|
|
464
|
+
let ids = filter(arrItems, isestr)
|
|
465
|
+
|
|
466
|
+
return ids
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
function atParseS2(composItems) {
|
|
471
|
+
|
|
472
|
+
//check
|
|
473
|
+
if (!isestr(composItems)) {
|
|
474
|
+
return []
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
//arrItems
|
|
478
|
+
let arrItems = sepItems(composItems)
|
|
479
|
+
|
|
480
|
+
//ids
|
|
481
|
+
let ids = []
|
|
482
|
+
each(arrItems, (v) => {
|
|
483
|
+
let s = sep(v, dlmSep)
|
|
484
|
+
// console.log(`size(s)`, size(s))
|
|
485
|
+
let table = get(s, 0, '')
|
|
486
|
+
table = trim(table)
|
|
487
|
+
let id = get(s, 1, '')
|
|
488
|
+
id = trim(id)
|
|
489
|
+
if (table === '') {
|
|
490
|
+
console.log(`atParseS2: invalid keyTable[${keyTable}] in composItems`, v, composItems)
|
|
491
|
+
}
|
|
492
|
+
else if (id === '') {
|
|
493
|
+
console.log(`atParseS2: invalid keyId[${keyId}] in composItems`, v, composItems)
|
|
494
|
+
}
|
|
495
|
+
if (size(s) >= 3) {
|
|
496
|
+
//有2個以上id
|
|
497
|
+
s = drop(s)
|
|
498
|
+
id = s //改儲存為陣列
|
|
499
|
+
}
|
|
500
|
+
ids.push({
|
|
501
|
+
item: v,
|
|
502
|
+
[keyTable]: table,
|
|
503
|
+
[keyId]: id,
|
|
504
|
+
})
|
|
505
|
+
})
|
|
506
|
+
|
|
507
|
+
return ids
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
function atParse(composItems, opt = {}) {
|
|
512
|
+
|
|
513
|
+
//check
|
|
514
|
+
if (!isestr(composItems)) {
|
|
515
|
+
return []
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
//mode
|
|
519
|
+
let mode = get(opt, 'mode')
|
|
520
|
+
if (mode !== '1p' && mode !== '2p') {
|
|
521
|
+
mode = 'auto'
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
//mode
|
|
525
|
+
if (mode === '1p') {
|
|
526
|
+
return atParseS1(composItems)
|
|
527
|
+
}
|
|
528
|
+
else if (mode === '2p') {
|
|
529
|
+
return atParseS2(composItems)
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
//indexOf
|
|
533
|
+
let bc = composItems.indexOf(dlmSep) >= 0
|
|
534
|
+
|
|
535
|
+
if (bc) {
|
|
536
|
+
return atParseS2(composItems)
|
|
537
|
+
}
|
|
538
|
+
return atParseS1(composItems)
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
function atAddS1(composItems1, composItems2) {
|
|
543
|
+
|
|
544
|
+
//atParseS1
|
|
545
|
+
let itp1 = atParseS1(composItems1)
|
|
546
|
+
let itp2 = atParseS1(composItems2)
|
|
547
|
+
|
|
548
|
+
//its
|
|
549
|
+
let its = [...itp1, ...itp2]
|
|
550
|
+
|
|
551
|
+
//check
|
|
552
|
+
if (size(its) === 0) {
|
|
553
|
+
return ''
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return atItemsMergeS1(its)
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
function atAddS2(composItems1, composItems2) {
|
|
561
|
+
|
|
562
|
+
//atParseS2
|
|
563
|
+
let itp1 = atParseS2(composItems1)
|
|
564
|
+
let itp2 = atParseS2(composItems2)
|
|
565
|
+
|
|
566
|
+
//its
|
|
567
|
+
let its = [...itp1, ...itp2]
|
|
568
|
+
|
|
569
|
+
//check
|
|
570
|
+
if (size(its) === 0) {
|
|
571
|
+
return ''
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return atItemsMergeS2(its)
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
function atAdd(composItems1, composItems2, opt = {}) {
|
|
579
|
+
|
|
580
|
+
//mode
|
|
581
|
+
let mode = get(opt, 'mode')
|
|
582
|
+
if (mode !== '1p' && mode !== '2p') {
|
|
583
|
+
mode = 'auto'
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
//mode
|
|
587
|
+
if (mode === '1p') {
|
|
588
|
+
atAddS1(composItems1, composItems2)
|
|
589
|
+
}
|
|
590
|
+
else if (mode === '2p') {
|
|
591
|
+
return atAddS2(composItems1, composItems2)
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
//indexOf
|
|
595
|
+
let bc1 = composItems1.indexOf(dlmSep) >= 0
|
|
596
|
+
let bc2 = composItems2.indexOf(dlmSep) >= 0
|
|
597
|
+
|
|
598
|
+
if (bc1 || bc2) {
|
|
599
|
+
return atAddS2(composItems1, composItems2)
|
|
600
|
+
}
|
|
601
|
+
return atAddS1(composItems1, composItems2)
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
function atRemoveS1(composItems1, composItems2) {
|
|
606
|
+
|
|
607
|
+
//atParseS1
|
|
608
|
+
let itp1 = atParseS1(composItems1)
|
|
609
|
+
let itp2 = atParseS1(composItems2)
|
|
610
|
+
|
|
611
|
+
//its
|
|
612
|
+
let its = []
|
|
613
|
+
each(itp1, (v) => {
|
|
614
|
+
if (!arrHas(v, itp2)) {
|
|
615
|
+
its.push(v)
|
|
616
|
+
}
|
|
617
|
+
})
|
|
618
|
+
|
|
619
|
+
//check
|
|
620
|
+
if (size(its) === 0) {
|
|
621
|
+
return ''
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
return atItemsMergeS1(its)
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
function atRemoveS2(composItems1, composItems2) {
|
|
629
|
+
|
|
630
|
+
//atParseS2
|
|
631
|
+
let itp1 = atParseS2(composItems1)
|
|
632
|
+
let itp2 = atParseS2(composItems2)
|
|
633
|
+
|
|
634
|
+
//its
|
|
635
|
+
let its = []
|
|
636
|
+
each(itp1, (v) => {
|
|
637
|
+
if (!arrHas(v, itp2)) {
|
|
638
|
+
its.push(v)
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
//check
|
|
643
|
+
if (size(its) === 0) {
|
|
644
|
+
return ''
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return atItemsMergeS2(its)
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
function atRemove(composItems, removeItemOrId, opt = {}) {
|
|
652
|
+
|
|
653
|
+
//check composItems
|
|
654
|
+
if (!isestr(composItems)) {
|
|
655
|
+
return ''
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
//check removeItemOrId
|
|
659
|
+
if (!isestr(removeItemOrId)) {
|
|
660
|
+
return composItems
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
//mode
|
|
664
|
+
let mode = get(opt, 'mode')
|
|
665
|
+
if (mode !== '1p' && mode !== '2p') {
|
|
666
|
+
mode = 'auto'
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
//mode
|
|
670
|
+
if (mode === '1p') {
|
|
671
|
+
return atRemoveS1(composItems, removeItemOrId)
|
|
672
|
+
}
|
|
673
|
+
else if (mode === '2p') {
|
|
674
|
+
return atRemoveS2(composItems, removeItemOrId)
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
//indexOf
|
|
678
|
+
// let bc = composItems.indexOf(dlmSep) >= 0
|
|
679
|
+
let bt = removeItemOrId.indexOf(dlmSep) >= 0
|
|
680
|
+
|
|
681
|
+
if (bt) { //bc可為空字串故不一定有dlmSep
|
|
682
|
+
return atRemoveS2(composItems, removeItemOrId)
|
|
683
|
+
}
|
|
684
|
+
return atRemoveS1(composItems, removeItemOrId)
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
//at
|
|
617
688
|
let at = {
|
|
618
689
|
parse: atParse,
|
|
619
690
|
join: atJoin,
|
|
620
691
|
remove: atRemove,
|
|
621
692
|
add: atAdd,
|
|
622
693
|
}
|
|
694
|
+
|
|
623
695
|
return at
|
|
624
696
|
}
|
|
625
697
|
|
|
626
698
|
|
|
627
|
-
export default attstr
|
|
699
|
+
export default attstr
|