"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var formatAsGroupedString_1 = __importDefault(require("./formatAsGroupedString"));
/**
* Format the expiry date '1223' to format like '12/23'
*
* @param value The expiry date value of a credit card like '1223'
* @param separator
* @category number
* @module formatCardExp
*/
var formatCardExp = function (value, separator) {
if (separator === void 0) { separator = ' / '; }
// Replace extra slashes "/" of value first before formatting
var normalizedValue = value
.split(separator)
.map(function (segment) { return segment.replace(/\//g, ''); })
.join(separator);
return (0, formatAsGroupedString_1.default)({
value: normalizedValue,
groupSize: 2,
maxNumGroup: 2,
separator: separator,
});
};
exports.default = formatCardExp;
Source