utiller 1.0.227 → 1.0.228
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
CHANGED
|
@@ -928,15 +928,11 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
928
928
|
}
|
|
929
929
|
}, {
|
|
930
930
|
key: "getStringOfCreditCardFormatted",
|
|
931
|
-
value: function getStringOfCreditCardFormatted(
|
|
932
|
-
var
|
|
933
|
-
var
|
|
934
|
-
//
|
|
935
|
-
|
|
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("-")) || "";
|
|
931
|
+
value: function getStringOfCreditCardFormatted() {
|
|
932
|
+
var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
933
|
+
var inputValue = string.replace(/\D/g, ""); // Remove all non-digit characters
|
|
934
|
+
var result = inputValue.replace(/(\d{4})(?=\d)/g, "$1-"); // Add a dash every 4 digits
|
|
935
|
+
return result.slice(0, 16);
|
|
940
936
|
}
|
|
941
937
|
}, {
|
|
942
938
|
key: "getObjectKey",
|
package/package.json
CHANGED