0.5.0 • Published 8 months ago

uscc-utils v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

uscc-utils

CI NPM VERSION NPM DOWNLOADS CODECOV 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

0.5.0

8 months ago

0.4.0

8 months ago

0.1.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.0.5

1 year ago

0.3.1

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago