utiller 1.0.236 → 1.0.237
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/lib/utiller/index.js +26 -18
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/utiller/index.js
CHANGED
|
@@ -418,7 +418,11 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
418
418
|
}
|
|
419
419
|
}, {
|
|
420
420
|
key: "accumulate",
|
|
421
|
-
value:
|
|
421
|
+
value:
|
|
422
|
+
/** 就是把 target 放到 condition 裡面處理, 然後取代原本的target
|
|
423
|
+
*
|
|
424
|
+
* condition2(condition1(target)) => 為了應付 collection(path).where('age','>',11).orderBy('age');
|
|
425
|
+
* */
|
|
422
426
|
function accumulate(target, conditions) {
|
|
423
427
|
var beginning = target;
|
|
424
428
|
var _iterator2 = _createForOfIteratorHelper(conditions),
|
|
@@ -750,6 +754,16 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
750
754
|
return name;
|
|
751
755
|
}
|
|
752
756
|
|
|
757
|
+
/** getPathOfReplaceLastDir('folder1/folder2/folder3', 'folder7') => 'folder1/folder2/folder7' */
|
|
758
|
+
}, {
|
|
759
|
+
key: "getPathOfReplaceLastDir",
|
|
760
|
+
value: function getPathOfReplaceLastDir(path, name) {
|
|
761
|
+
var split = path.split("/");
|
|
762
|
+
split.pop();
|
|
763
|
+
split.push(name);
|
|
764
|
+
return split.join("/");
|
|
765
|
+
}
|
|
766
|
+
|
|
753
767
|
/** http://wnj.cdji/david.mp3 => mp3 */
|
|
754
768
|
}, {
|
|
755
769
|
key: "getExtensionFromPath",
|
|
@@ -770,9 +784,7 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
770
784
|
|
|
771
785
|
/**
|
|
772
786
|
* 取得folderName
|
|
773
|
-
*
|
|
774
|
-
* console.log(utiller.getFolderNameOfFilePath(`das/asdiasjiosd/jif/d.js`)); // jif
|
|
775
|
-
*
|
|
787
|
+
* console.log(utiller.getFolderNameOfFilePath(`das/asdiasjiosd/jif/d.js`)); //ans:'jif'
|
|
776
788
|
* */
|
|
777
789
|
}, {
|
|
778
790
|
key: "getFolderNameOfFilePath",
|
|
@@ -1030,7 +1042,6 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
1030
1042
|
* array = ['a','b','c'];
|
|
1031
1043
|
* current = array[1] === 'b'
|
|
1032
1044
|
* latest = 'd'
|
|
1033
|
-
*
|
|
1034
1045
|
* return ['a','d','c']
|
|
1035
1046
|
* */
|
|
1036
1047
|
}, {
|
|
@@ -2349,9 +2360,7 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2349
2360
|
}
|
|
2350
2361
|
|
|
2351
2362
|
/**
|
|
2352
|
-
*
|
|
2353
2363
|
* 把指定的array item 放到頭尾
|
|
2354
|
-
*
|
|
2355
2364
|
* const array = ['a','b','c','d'];
|
|
2356
2365
|
* console.log(util.getArrayOfMoveSpecificItemToAside(array,array[1]));
|
|
2357
2366
|
*[ 'a', 'c', 'd', 'b' ]
|
|
@@ -2365,11 +2374,10 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2365
2374
|
}
|
|
2366
2375
|
|
|
2367
2376
|
/** 把指定的index放到頭尾
|
|
2368
|
-
*
|
|
2369
2377
|
* const array = ['a','b','c','d'];
|
|
2370
2378
|
console.log(util.getArrayOfMoveSpecificIndexToAside(array,3,false));
|
|
2371
2379
|
[ 'd', 'a', 'b', 'c' ]
|
|
2372
|
-
|
|
2380
|
+
**/
|
|
2373
2381
|
}, {
|
|
2374
2382
|
key: "getArrayOfMoveSpecificIndexToAside",
|
|
2375
2383
|
value: function getArrayOfMoveSpecificIndexToAside(array, index) {
|
|
@@ -2410,15 +2418,15 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2410
2418
|
return _lodash["default"].toUpper(_cryptoJs["default"].SHA256(checkValue).toString(_cryptoJs["default"].enc.Hex));
|
|
2411
2419
|
}
|
|
2412
2420
|
|
|
2413
|
-
/**
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2421
|
+
/** 把一段html文字轉換成類似document的結構 處理後再回傳文字
|
|
2422
|
+
const result = utiller.getStringOfHandleHtml(
|
|
2423
|
+
'<form id="_form_aiochk" action="https://payment-stage.ecpay.com.tw/Cashier/AioCheckOut/V5" method="post"><input type="hidden" name="MerchantTradeNo" id="MerchantTradeNo" value="sO6E2IilSGYpCChDqrI2" /><input type="hidden" name="MerchantTradeDate" id="MerchantTradeDate" value="2022/07/02 05:16:32" />' +
|
|
2424
|
+
'<input type="hidden" name="TotalAmount" id="TotalAmount" value="350" /><input type="hidden" name="TradeDesc" id="TradeDesc" value="綠界第三方支付(明悅科技-線上支付)" /><input type="hidden" name="ItemName" id="ItemName" value="iphone13 pro x 2 = 200 元#iphone11 x 3 = 150 元#總價 350 元##※備註: 無備註內容" /><input type="hidden" name="ReturnURL" id="ReturnURL" value="https://us-central1-davidtu-dev.cloudfunctions.net/confirmedByByECPay" /><input type="hidden" name="ClientBackURL" id="ClientBackURL" value="https://www.google.com/" /><input type="hidden" name="ExpireDate" id="ExpireDate" value="1" /><input type="hidden" name="PaymentInfoURL" id="PaymentInfoURL" value="https://us-central1-davidtu-dev.cloudfunctions.net/paymentInfoByECPay" /><input type="hidden" name="ChoosePayment" id="ChoosePayment" value="ALL" /><input type="hidden" name="PlatformID" id="PlatformID" value="" /><input type="hidden" name="MerchantID" id="MerchantID" value="2000132" /><input type="hidden" name="InvoiceMark" id="InvoiceMark" value="N" /><input type="hidden" name="IgnorePayment" id="IgnorePayment" value="BARCODE#AndroidPay#ApplePay" /><input type="hidden" name="DeviceSource" id="DeviceSource" value="" /><input type="hidden" name="EncryptType" id="EncryptType" value="1" /><input type="hidden" name="PaymentType" id="PaymentType" value="aio" />' +
|
|
2425
|
+
'<input type="hidden" name="CheckMacValue" id="CheckMacValue" value="D55E9E48C6AB83C063E0E13AD1B8C2EE8FA6547A7D7FCB33860B532E97D808BC" /><script type="text/javascript">document.getElementById("_form_aiochk").submit();</script></form>'
|
|
2426
|
+
,(document) => {
|
|
2427
|
+
const element = document.getElementById('CheckMacValue');
|
|
2428
|
+
element.setAttribute('value', '123456');
|
|
2429
|
+
})
|
|
2422
2430
|
*/
|
|
2423
2431
|
}, {
|
|
2424
2432
|
key: "getStringOfHandledHtml",
|
package/package.json
CHANGED