uscc-utils
v0.6.1
Published
Utils about unified social credit code | 统一社会信用代码工具方法
Downloads
137
Maintainers
Readme
uscc-utils
Utils about unified social credit code(统一社会信用代码工具方法).
Install
npm i uscc-utils
yarn add uscc-utils
pnpm add uscc-utils
Usage
import { parseUSCC, validateUSCC } from 'uscc-utils'
const code = '91110108551385082Q' // 小米科技有限责任公司
validateUSCC(code) // true
parseUSCC(code) // { isValid: true, category: '工商', type: '企业' }
API
validateUSCC
Check if the given code match the uscc pattern.
Type definition:
function validateUSCC(code: string): boolean
parseUSCC
Parse the given uscc.
Type definition:
interface ParseOptions {
unknownCategory?: string
unknownType?: string
}
interface ParseResult {
isValid: boolean
category: string
type: string
}
function parseUSCC(code: string, options?: ParseOptions): ParseResult