sg-ic-utils
v1.1.2
Published
Utility module for Singapore ICs
Downloads
2
Readme
SG IC Utils
Utility module for generating and validating Singapore ICs (Identification Numbers).
Installation
npm install sg-ic-utils --save
Usage
const { generateDummySGICs, validateSGIC, maskString } = require('sg-ic-utils');
const singleSGIC = generateDummySGICs();
console.log('Generated SGIC:', singleSGIC);
const dummySGICs = generateDummySGICs(5);
console.log('Generated SGICs:', dummySGICs);
const isValid = validateSGIC(singleSGIC);
console.log('Is Valid SGIC?', isValid);
const maskedIC = maskString('A1234567B');
console.log(`Masked IC: ${maskedIC}`); // Output: '*****567B'
Modules 1: generateDummySGICs(count = 1)
Generates an array of random Singapore ICs.
count (optional)
: Number of ICs to generate. Default is1
.
Modules 2: validateSGIC(sgic: string): boolean
Validates the format of a given Singapore IC.
sgic
: The Singapore IC to validate.
Returns true
if the SGIC is valid, false
otherwise.
Modules 3: maskString(inputString, visibleRange = [0, -4])
Masks characters within the specified range in a string.
inputString
: The input string to mask.visibleRange
(optional): An array specifying the visible range. Default is[0, -4]
.
Disclaimer
The Singapore ICs (Identification Numbers) generated by this utility module (sg-ic-utils
) are intended for testing and development purposes only. These ICs are randomly generated and do not represent real, valid identification numbers.
Important Notes:
Not for Production Use: The generated ICs should not be used in a production environment or any situation where real, valid identification numbers are required.
No Personal Information: The generated ICs do not contain any real personal information. They are entirely fictitious and should not be treated as such.
Limited Validation: While the module provides a basic validation function (
validateSGIC
), it does not guarantee the correctness or validity of the generated ICs. It is advised to perform additional testing and validation based on your specific use case.
By using this utility module, you acknowledge and accept these disclaimers. The author and contributors are not responsible for any misuse or consequences arising from the use of the generated ICs.
Please use responsibly and ethically.