Code Monkey home page Code Monkey logo

social-insurance-number's Introduction

social-insurance-number Default Code Climate

Notice

This repo is now archived. The library has been moved into client-core.

If you are using the public version of this package that is published on the yarn registry, please switch over to using the private version of this package that is published on Nexus. You can do this using: yarn remove social-insurance-number && yarn add @wealthsimple/social-insurance-number.


social-insurance-number is a Canadian SIN (Social Insurance Number) parser and generator for the browser and Node.js.

Parsing

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: []

Generating

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"

social-insurance-number's People

Contributors

6 avatar dependabot[bot] avatar pfeffer avatar natashad avatar sterlingwes avatar gitguudd avatar abejfehr avatar cchawn avatar cabello avatar dinahshi avatar nicholas-tao avatar osman avatar scottybarr avatar tylermarien avatar verkhoro avatar

Stargazers

Keegan McCallum avatar  avatar  avatar Adi Mankotia avatar Kim S. Ly avatar Karl Pawlowicz avatar Andrew avatar Charles Morin avatar Son Dinh avatar Rafael Servatti avatar Rodolfo avatar Ali Waseem avatar Matt avatar Gavin Cai avatar  avatar Matt Rintoul avatar TrueMagic avatar Douglas Eggleton avatar Kelly Barber avatar Steve Lyall avatar Logan Geefs avatar Sal Rahman avatar Dmitry avatar Arjan Jassal avatar Brent Lintner avatar Ragns avatar Martin Sieniawski avatar Henry Hsiao avatar Ashwin Balamohan avatar

Watchers

Calvin Rodo avatar  avatar Brett Huneycutt avatar Tom Creighton avatar Karney Li avatar Gord Tanner avatar  avatar Leslie Partridge avatar Chuck avatar Justin Holdstock avatar Marina Samuel avatar Steve Houser avatar James Cloos avatar Dhruv Gairola avatar Nick Ma avatar Pawel Chomicki avatar Ajay Mehta avatar Jean-Philippe Rivard Lauzier avatar John Grant avatar Junjie Chen avatar Alexander Kudryavtsev avatar Lizhen (Lisa) Tang avatar J R Mykolyn avatar Melisa Cecilia avatar Rodolfo avatar Chris Wilson avatar Daniel Rodriguez avatar Jake Madison avatar Alyssa Dunn avatar Mo Binni avatar  avatar Kyrylo Shegeda avatar Germán León Zapata avatar  avatar Vincent Truong avatar Michael Bennett avatar Ben Black avatar Yunkee Lee avatar  avatar David Fay avatar Phil Swanson avatar Adrian Davila-Zuniga avatar April Violet avatar Jeff Shin avatar Niroshan Sooriyakumar avatar Rem Kim avatar Yvonne Baki avatar Binuri Walpitagamage avatar Nick Cramaro avatar Adriano Skroch avatar  avatar yifeng avatar Guillermo Davalos Lopez avatar Sam Power avatar Najwa Azer avatar Shawn Compton avatar Ryan McCormack avatar  avatar Jocelyn Jeffrey avatar Anson Poon avatar Visaahan Anandarajah avatar Trevor Ophelders avatar Evan Knox avatar Hyun Choi avatar Stephen Kubovic avatar  avatar Inga Jonsdottir avatar Sean Pollock avatar Calvin Cheng avatar Keith Wong avatar Emmanuel Sogelola avatar Abeer Khan avatar Lisa Weng avatar Balraj Shah avatar  avatar Alejandro Ramirez-Sanabria avatar David (DA) avatar Ross Barclay avatar Obinna Elobi avatar Ahmed Sakr avatar  avatar Kenneth Foo avatar Jon Ng avatar Geoff Bremner avatar Andrew Choly avatar Keaton Neville avatar Andrei Lyskov avatar al avatar Torie Joy-Warren avatar Terence Lam avatar Thomas Lui avatar Chris Bishop avatar Juliana avatar Udara Weerasinghege avatar Greye Smyth avatar Shah Syed avatar Robin V. avatar  avatar Rameen Rastan avatar Jordan Deutsch avatar

social-insurance-number's Issues

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.