@acmvit/vit-registration-number 中文文档教程
vit-registration-number
曾经想快速验证 VIT 中的注册号并读取数据吗? 那么这个包是给你的。 这是一个简单的用法。
Usage
# install the package
npm install @acmvit/vit-registration-number
在代码中使用
const RegistrationNumber = require("@acmvit/vit-registration-number")
const someNumber = new RegistrationNumber("19BCE2669")
const year = someNumber.getYear()
// => 19
const branch = someNumber.getBranch();
// => BCE
const index = someNumber.getIndex();
// => 2669
无需担心验证 对注册号的所有部分进行严格的类型检查。 如果注册号格式不正确,将抛出错误,以便于检查。 验证数字时始终包裹在 try-catch 块中。
vit-registration-number
Ever wanted to quickly validate and read data off a registration number in VIT? Then this package is for you. Here's a simple usage.
Usage
# install the package
npm install @acmvit/vit-registration-number
Using in Code
const RegistrationNumber = require("@acmvit/vit-registration-number")
const someNumber = new RegistrationNumber("19BCE2669")
const year = someNumber.getYear()
// => 19
const branch = someNumber.getBranch();
// => BCE
const index = someNumber.getIndex();
// => 2669
No need to worry about validation Strict type checking for all sections of the registration number. Will throw an error if the registration number is malformed, so that it's easy to check. Always wrap inside a try-catch block when validating numbers.