Skip to content

Commit

Permalink
Add IsStrictValid and IsLooseValid methods
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed Mar 4, 2022
1 parent 818e0e7 commit e66e6eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions id_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func IsValid(id string, strict bool) bool {
return code["checkBit"] == generatorCheckBit(code["body"])
}

// IsLooseValid 宽松验证身份证号合法性
func IsLooseValid(id string) bool {
return IsValid(id, false)
}

// IsStrictValid 严格验证身份证号合法性
func IsStrictValid(id string) bool {
return IsValid(id, true)
}

// GetInfo 获取身份证信息
func GetInfo(id string, strict bool) (IdInfo, error) {
// 验证有效性
Expand Down

0 comments on commit e66e6eb

Please sign in to comment.