utiller 1.0.149 → 1.0.150
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.
|
@@ -49,6 +49,8 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
49
49
|
|
|
50
50
|
var _prompt = _interopRequireDefault(require("prompt"));
|
|
51
51
|
|
|
52
|
+
var _nodeHtmlParser = require("node-html-parser");
|
|
53
|
+
|
|
52
54
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
53
55
|
|
|
54
56
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -1798,6 +1800,29 @@ var NodeUtiller = /*#__PURE__*/function (_Utiller) {
|
|
|
1798
1800
|
this.appendFile(destination, content, true, true);
|
|
1799
1801
|
this.appendInfo("rewrite from:".concat(from, " => dest:").concat(destination, " succeed"));
|
|
1800
1802
|
}
|
|
1803
|
+
/**
|
|
1804
|
+
* 把一段html文字轉換成類似document的結構 處理後再回傳文字
|
|
1805
|
+
*
|
|
1806
|
+
// const result = utiller.getStringOfHandleHtml('<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" />' +
|
|
1807
|
+
// '<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" />' +
|
|
1808
|
+
// '<input type="hidden" name="CheckMacValue" id="CheckMacValue" value="D55E9E48C6AB83C063E0E13AD1B8C2EE8FA6547A7D7FCB33860B532E97D808BC" /><script type="text/javascript">document.getElementById("_form_aiochk").submit();</script></form>'
|
|
1809
|
+
// , (document) => {
|
|
1810
|
+
// const element = document.getElementById('CheckMacValue');
|
|
1811
|
+
// element.setAttribute('value', '123456');
|
|
1812
|
+
// return document;
|
|
1813
|
+
// })
|
|
1814
|
+
*/
|
|
1815
|
+
|
|
1816
|
+
}, {
|
|
1817
|
+
key: "getStringOfHandledHtml",
|
|
1818
|
+
value: function getStringOfHandledHtml(string) {
|
|
1819
|
+
var predicate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (document) {
|
|
1820
|
+
return document;
|
|
1821
|
+
};
|
|
1822
|
+
var document = (0, _nodeHtmlParser.parse)(string);
|
|
1823
|
+
var handled = predicate(document);
|
|
1824
|
+
return handled.toString();
|
|
1825
|
+
}
|
|
1801
1826
|
}]);
|
|
1802
1827
|
return NodeUtiller;
|
|
1803
1828
|
}(_index["default"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "utiller",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.150",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"fs-extra": "^9.1.0",
|
|
20
20
|
"lodash": "^4.17.20",
|
|
21
21
|
"moment": "^2.29.1",
|
|
22
|
+
"node-html-parser": "^5.3.3",
|
|
22
23
|
"pdf-parse": "^1.1.1",
|
|
23
24
|
"prompt": "^1.1.0",
|
|
24
25
|
"uuid": "^8.3.2"
|