utiller 1.0.225 → 1.0.227
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 +10 -5
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/utiller/index.js
CHANGED
|
@@ -177,8 +177,7 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* 刪除物件裡面特別的屬性,預設是刪除value為undefined
|
|
180
|
-
|
|
181
|
-
* */
|
|
180
|
+
**/
|
|
182
181
|
function removeAttributeBy(object) {
|
|
183
182
|
var predicate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (value) {
|
|
184
183
|
return _lodash["default"].isUndefined(value);
|
|
@@ -929,9 +928,15 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
929
928
|
}
|
|
930
929
|
}, {
|
|
931
930
|
key: "getStringOfCreditCardFormatted",
|
|
932
|
-
value: function getStringOfCreditCardFormatted(
|
|
933
|
-
var
|
|
934
|
-
|
|
931
|
+
value: function getStringOfCreditCardFormatted(input) {
|
|
932
|
+
var _cleaned$match;
|
|
933
|
+
var cleaned = input.replace(/\D/g, "");
|
|
934
|
+
// 取前16個字元
|
|
935
|
+
if (cleaned.length > 16) {
|
|
936
|
+
cleaned = cleaned.slice(0, 16);
|
|
937
|
+
}
|
|
938
|
+
// 插入`-`每4個字符
|
|
939
|
+
return ((_cleaned$match = cleaned.match(/.{1,4}/g)) === null || _cleaned$match === void 0 ? void 0 : _cleaned$match.join("-")) || "";
|
|
935
940
|
}
|
|
936
941
|
}, {
|
|
937
942
|
key: "getObjectKey",
|
package/package.json
CHANGED