@zodash/idcard
Version:
chinese id card parser, generator and validator
17 lines (16 loc) • 516 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = void 0;
const constants_1 = require("./constants");
function parse(cardNumber) {
var _a, _b;
const { address, birthday, police, sex, checkCode } = (_b = (_a = cardNumber.match(constants_1.NAMED_REGEX)) === null || _a === void 0 ? void 0 : _a.groups) !== null && _b !== void 0 ? _b : {};
return {
address,
birthday,
police,
sex,
checkCode,
};
}
exports.parse = parse;