Skip to content

Commit 2444219

Browse files
committed
feat: 更新身份证工具类,新增身份证信息接口及相关功能,完善导出项,优化类型安全和错误处理。
1 parent 1b70c7d commit 2444219

8 files changed

Lines changed: 915 additions & 309 deletions

File tree

docs/api/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["index",{"type":"dir","label":"Functions","name":"functions"}]
1+
["index",{"type":"dir","label":"Functions","name":"functions"},{"type":"dir","label":"Interfaces","name":"interfaces"}]

docs/api/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Table of contents
44

5+
### Interfaces
6+
7+
- [GenerateIdCardOptions](./interfaces/GenerateIdCardOptions.md)
8+
- [IdCardInfo](./interfaces/IdCardInfo.md)
9+
- [IdCardResult](./interfaces/IdCardResult.md)
10+
511
### Functions
612

713
- [accAdd](./functions/accAdd.md)
@@ -38,6 +44,7 @@
3844
- [formatPhone](./functions/formatPhone.md)
3945
- [formatTimeAgo](./functions/formatTimeAgo.md)
4046
- [generateGUID](./functions/generateGUID.md)
47+
- [generateIdCard](./functions/generateIdCard.md)
4148
- [get](./functions/get.md)
4249
- [getBrowser](./functions/getBrowser.md)
4350
- [getCookie](./functions/getCookie.md)
@@ -46,6 +53,9 @@
4653
- [getDays](./functions/getDays.md)
4754
- [getDevice](./functions/getDevice.md)
4855
- [getDiffDay](./functions/getDiffDay.md)
56+
- [getIdCardAge](./functions/getIdCardAge.md)
57+
- [getIdCardGender](./functions/getIdCardGender.md)
58+
- [getIdCardRegion](./functions/getIdCardRegion.md)
4959
- [getImgBase64](./functions/getImgBase64.md)
5060
- [getIn](./functions/getIn.md)
5161
- [getLocationHrefParam](./functions/getLocationHrefParam.md)
@@ -149,6 +159,7 @@
149159
- [objectFromPairs](./functions/objectFromPairs.md)
150160
- [objectToPairs](./functions/objectToPairs.md)
151161
- [only](./functions/only.md)
162+
- [parseIdCard](./functions/parseIdCard.md)
152163
- [photoCompress](./functions/photoCompress.md)
153164
- [preZeroFill](./functions/preZeroFill.md)
154165
- [prettyBytes](./functions/prettyBytes.md)
@@ -169,3 +180,4 @@
169180
- [transferHumpUnderline](./functions/transferHumpUnderline.md)
170181
- [trim](./functions/trim.md)
171182
- [urlJoin](./functions/urlJoin.md)
183+
- [validateIdCard](./functions/validateIdCard.md)

generateExports.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function generateExportStatements(files) {
2727
return files
2828
.map(file => {
2929
const fileName = path.basename(file, '.ts');
30-
if (fileName === 'is' || fileName === 'cookie'|| fileName === 'math') {
30+
if (fileName === 'is' || fileName === 'cookie'|| fileName === 'math'|| fileName === 'idCard') {
3131
return `export * from './${fileName}';`;
3232
}
3333
return `export { ${fileName} } from './${fileName}';`;

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@
6767
"pre-commit": "npm run type-check && npm test"
6868
},
6969
"dependencies": {
70-
"decimal.js": "^10.4.1"
70+
"decimal.js": "^10.4.1",
71+
"idcard": "4.2.0"
7172
},
7273
"devDependencies": {
7374
"@rslib/core": "^0.13.1",
74-
"@rspress/plugin-typedoc": "^1.43.9",
75+
"@rspress/plugin-typedoc": "^1.45.6",
7576
"@types/glob": "^9.0.0",
7677
"@vitest/coverage-v8": "^3.0.0",
7778
"bumpp": "^10.2.0",
@@ -81,10 +82,11 @@
8182
"inquirer": "^12.7.0",
8283
"prettier": "^3.5.2",
8384
"publint": "^0.3.12",
84-
"rspress": "^1.44.0",
85+
"rspress": "^1.45.6",
8586
"rspress-plugin-sitemap": "^1.2.0",
8687
"simple-git-hooks": "^2.9.0",
87-
"typescript": "5.9.2",
88+
"typedoc": "0.28.13",
89+
"typescript": "5.1.3",
8890
"vitest": "^3.0.0"
8991
},
9092
"repository": {

0 commit comments

Comments
 (0)