utiller 1.0.146 → 1.0.149
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 +48 -0
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/utiller/index.js
CHANGED
|
@@ -211,6 +211,11 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
211
211
|
|
|
212
212
|
return true;
|
|
213
213
|
}
|
|
214
|
+
}, {
|
|
215
|
+
key: "getSeparatorOfUnique",
|
|
216
|
+
value: function getSeparatorOfUnique() {
|
|
217
|
+
return "།།";
|
|
218
|
+
}
|
|
214
219
|
/** 1.0.1 => 1.0.2 */
|
|
215
220
|
|
|
216
221
|
}, {
|
|
@@ -224,6 +229,13 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
224
229
|
numbers[last] = numbers[last] + delta;
|
|
225
230
|
return numbers.join(".");
|
|
226
231
|
}
|
|
232
|
+
}, {
|
|
233
|
+
key: "setLocaleOfMoment",
|
|
234
|
+
value: function setLocaleOfMoment() {
|
|
235
|
+
var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "en";
|
|
236
|
+
|
|
237
|
+
_moment["default"].locale(locale);
|
|
238
|
+
}
|
|
227
239
|
}, {
|
|
228
240
|
key: "getUuidOfV4",
|
|
229
241
|
value: function getUuidOfV4() {
|
|
@@ -2325,6 +2337,42 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2325
2337
|
var indexOfLast = _lodash["default"].size(array) - 1;
|
|
2326
2338
|
return this.getArrayOfMoveToSpecificIndex(array, index, toTail ? indexOfLast : 0);
|
|
2327
2339
|
}
|
|
2340
|
+
}, {
|
|
2341
|
+
key: "getECPayCheckMacValue",
|
|
2342
|
+
value: function getECPayCheckMacValue(data) {
|
|
2343
|
+
var hashKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "5294y06JbISpM5x9";
|
|
2344
|
+
var hashIV = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "v77hoKGq4kWxNNIS";
|
|
2345
|
+
|
|
2346
|
+
var clone = _lodash["default"].cloneDeep(data);
|
|
2347
|
+
|
|
2348
|
+
delete clone.CheckMacValue;
|
|
2349
|
+
var keys = Object.keys(clone).sort(function (l, r) {
|
|
2350
|
+
return l > r ? 1 : -1;
|
|
2351
|
+
});
|
|
2352
|
+
var checkValue = "";
|
|
2353
|
+
|
|
2354
|
+
var _iterator16 = _createForOfIteratorHelper(keys),
|
|
2355
|
+
_step16;
|
|
2356
|
+
|
|
2357
|
+
try {
|
|
2358
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
2359
|
+
var key = _step16.value;
|
|
2360
|
+
checkValue += "".concat(key, "=").concat(clone[key], "&");
|
|
2361
|
+
}
|
|
2362
|
+
} catch (err) {
|
|
2363
|
+
_iterator16.e(err);
|
|
2364
|
+
} finally {
|
|
2365
|
+
_iterator16.f();
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
checkValue = "HashKey=".concat(hashKey, "&").concat(checkValue, "HashIV=").concat(hashIV); // There is already an & in the end of checkValue
|
|
2369
|
+
|
|
2370
|
+
checkValue = encodeURIComponent(checkValue).toLowerCase();
|
|
2371
|
+
checkValue = checkValue.replace(/%20/g, "+").replace(/%2d/g, "-").replace(/%5f/g, "_").replace(/%2e/g, ".").replace(/%21/g, "!").replace(/%2a/g, "*").replace(/%28/g, "(").replace(/%29/g, ")").replace(/%20/g, "+");
|
|
2372
|
+
checkValue = _crypto["default"].createHash("sha256").update(checkValue).digest("hex");
|
|
2373
|
+
checkValue = checkValue.toUpperCase();
|
|
2374
|
+
return checkValue;
|
|
2375
|
+
}
|
|
2328
2376
|
}]);
|
|
2329
2377
|
return Utiller;
|
|
2330
2378
|
}();
|
package/package.json
CHANGED