Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
social-insurance-number
Advanced tools
Canadian SIN (Social Insurance Number) parser and generator
social-insurance-number
is a Canadian SIN (Social Insurance Number) parser and generator for the browser and Node.js.
Use the .isValid()
to determine SIN validity.
var sin = new SocialInsuranceNumber("130692544");
sin.isValid();
// Returns: true
sin = new SocialInsuranceNumber("123456789");
sin.isValid();
// Returns: false
Use .normalizedValue()
to get the normalized SIN value (all non-digits removed).
var sin = new SocialInsuranceNumber("130-692-544");
sin.normalizedValue();
// Returns "130692544"
sin = new SocialInsuranceNumber(" 130692544 ");
sin.normalizedValue();
// Returns "130692544"
Use .isTemporary()
to determine if the SIN is associated with a temporary resident.
var sin = new SocialInsuranceNumber("918640897");
sin.isTemporary();
// Returns: true
sin = new SocialInsuranceNumber("130692544");
sin.isTemporary();
// Returns: false
Use .isBusinessNumber()
to determine if the SIN is a Business Number.
var sin = new SocialInsuranceNumber("817640897");
sin.isBusinessNumber();
// Returns: true
sin = new SocialInsuranceNumber("130692544");
sin.isBusinessNumber();
// Returns: false
Use .provinces()
to get the Canadian provinces associated with the SIN.
var sin = new SocialInsuranceNumber("130692544");
sin.provinces();
// Returns: ['NB', 'NF', 'NS', 'PE']
var tempSin = new SocialInsuranceNumber("918640897");
tempSin.provinces();
// Returns: []
Use the .generate([options ])
class method to generate a valid random SIN number.
SocialInsuranceNumber.generate()
// Returns a random SIN, e.g. "130692544"
SocialInsuranceNumber.generate({province: "ON"});
// Returns a random SIN associated with Ontario, e.g. "464679711"
SocialInsuranceNumber.generate({startsWith: "8"});
// Returns a random SIN starting with 8, e.g. "851157206"
SocialInsuranceNumber.generate({startsWith: "12345"});
// Returns a random SIN starting with 12345, e.g. "123453235"
SocialInsuranceNumber.generate({doesNotStartWith: "1"});
// Returns a random SIN not starting with 1, e.g. "223453235"
SocialInsuranceNumber.generate({doesNotStartWith: ["1", "5"]});
// Returns a random SIN not starting with 1 or 5, e.g. "323453235"
FAQs
Canadian SIN (Social Insurance Number) parser and generator
We found that social-insurance-number demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.