Validate • Generate • Sanitize Code
VGSCode is a lightweight library that allows you to validate, generate, and sanitize various codes. Contributions are very welcome!
| Country | Supported Codes |
|---|---|
| Kazakhstan | IIN, BIN |
| ... | (More coming soon) |
Install via npm or pnpm:
npm install vgscodeor
pnpm install vgscodeImport the library in your project:
import vgscode from "vgscode";For CommonJS projects, require the package:
const vgscode = require("vgscode");// Validate BIN and IIN codes
vgscode.vBIN("320243026191"); // true
vgscode.vIIN("320229474023"); // false// Generate complete codes by providing a prefix
vgscode.gBIN("320243"); // "320243952485"
vgscode.gIIN("320229"); // "320229980830"// Remove all whitespace characters from the string
vgscode.sTrimAll("32 0229 4740 21"); // "320229474021"
// Remove all non-digit characters
vgscode.sRemoveNonDigits("320#%2294 74fwef021"); // "320229474021"
// Extract codes from a text
vgscode.sExtractCodes("Some text 320229474021 and more text", 12, vgscode.vBIN); //["320243026191"]Contributions are encouraged! Feel free to submit issues or pull requests on GitHub.
VGSCode is released under the MIT License.