Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ntnyq/uscc-utils

Repository files navigation

uscc-utils

CI NPM VERSION NPM DOWNLOADS LICENSE

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

Credits

License

MIT License © 2022-PRESENT ntnyq

About

🆗 Utils about unified social credit code | 统一社会信用代码工具方法.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •