diff options
-rw-r--r-- | README.md | 25 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | south-african-id-parser.js (renamed from index.js) | 0 | ||||
-rw-r--r-- | test/test.js | 2 |
4 files changed, 27 insertions, 2 deletions
@@ -19,6 +19,31 @@ and [here](http://knowles.co.za/generating-south-african-id-numbers/). Usage ----- +Download the library from NPM using the following command in a terminal: + +``` +npm install --save south-african-id-parser +``` + +### Usage In NodeJS + +``` +var saIdParser = require('south-african-id-parser'); +var info = saIdParser.parse('9001049818080'); +``` + +### Usage In the Browser + +When used in the browser, the library will add the `saIdParser` object +to the window for you to use. + +``` +<script src="south-african-id-parser.js"></script> +<script> + var info = saIdParser.parse('9001049818080'); +</script> +``` + ### Parse Everything The package exposes the `.parse(idNumber)` method for calling all of diff --git a/package.json b/package.json index 59a885f..c430b4d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "south-african-id-parser", "version": "0.0.2", "description": "A library for parsing and validating South African ID Numbers.", - "main": "index.js", + "main": "south-african-id-parser.js", "scripts": { "test": "mocha" }, diff --git a/index.js b/south-african-id-parser.js index 1405a5a..1405a5a 100644 --- a/index.js +++ b/south-african-id-parser.js diff --git a/test/test.js b/test/test.js index f0417ab..01fe3fd 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ var expect = require('chai').expect; -var saIdParser = require('../index.js'); +var saIdParser = require('../south-african-id-parser.js'); describe('South African ID Number Parsing', function() { var validIdNumbers = [{ |