Skip to content

Commit 0a9fef5

Browse files
committed
Create validator to validate South African phone numbers.
Signed-off-by: Gavin de Bruyn <gavindb@runninghill.co.za>
1 parent b01873b commit 0a9fef5

18 files changed

+5304
-274
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ speed-measure-plugin*.json
3131
!.vscode/extensions.json
3232
.history/*
3333

34+
# Coverage directory used by tools like istanbul
35+
coverage
36+
3437
# misc
3538
/.sass-cache
3639
/connect.lock

CONTRIBUTOR_README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Angular South African Form Validators
2+
3+
A set of South African specific validators for Angular forms.
4+
5+
# Getting Started
6+
7+
1. Clone the repo.
8+
9+
3. Navigate to `projects/rh-rsa-form-validators`
10+
11+
2. Run `npm install`.
12+
13+
4. Create a feature or bugfix branch.
14+
15+
3. Make your changes.
16+
17+
4. Ensure that your changes are of good quality and comply with our [Coding Standards](#coding-standards).
18+
19+
5. Commit your changes and submit a PR to merge your changes into `main`.
20+
21+
# NPM Scripts
22+
23+
To check eslint, run command `npm run lint`.
24+
25+
To check unit tests, run command `npm run test`.
26+
27+
# Contribute
28+
29+
Ensure you work out of the project itself (`projects/rh-rsa-form-validators`) and not the Angular workspace
30+
31+
Always make the code better, if you see errors, please fix them.
32+
33+
Add tests and try to move the code coverage up to 90%.
34+
35+
Update the [usage documentation](/projects/rh-rsa-form-validators/README.md).
36+
37+
Bump the version number according to [semantic versioning](https://semver.org/#semantic-versioning-200).
38+
39+
Adhere to the [Coding Standards](#coding-standards).
40+
41+
Only the classes and models exported in `public-api.ts` will be exposed through the package.
42+
43+
# Coding Standards
44+
45+
TODO: Define coding standards
46+
47+
- Form validators should not make the form control required.

README.md

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"commonjs": true,
5+
"es2021": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"plugins": [
13+
"@typescript-eslint"
14+
],
15+
"parserOptions": {
16+
"ecmaVersion": 12
17+
},
18+
"rules": {
19+
"complexity": ["error"],
20+
"default-case": ["error"],
21+
"eqeqeq": ["error"],
22+
"keyword-spacing": ["error"],
23+
"max-len": ["error", 120],
24+
"no-alert": ["error"],
25+
"no-console": ["error"],
26+
"no-else-return": ["error"],
27+
"no-extra-parens": ["error"],
28+
"no-multi-spaces": ["error"],
29+
"no-multiple-empty-lines": ["error", { "max" : 1 }],
30+
"no-unreachable-loop": ["error"],
31+
"no-template-curly-in-string": ["error"],
32+
"object-curly-spacing": ["error", "always"],
33+
"quotes": ["error", "single"],
34+
"semi": ["error", "never"]
35+
}
36+
}
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
# RhRsaFormValidators
1+
# Angular South African Form Validators
22

3-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.4.
3+
A set of South African specific validators for Angular forms.
44

5-
## Code scaffolding
5+
TODO: Add the Runninghill and Angular logos as well as some emojis
66

7-
Run `ng generate component component-name --project rh-rsa-form-validators` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project rh-rsa-form-validators`.
8-
> Note: Don't forget to add `--project rh-rsa-form-validators` or else it will be added to the default project in your `angular.json` file.
7+
# Getting Started
98

10-
## Build
9+
If you plan on contributing to the package please read the contributor readme.
1110

12-
Run `ng build rh-rsa-form-validators` to build the project. The build artifacts will be stored in the `dist/` directory.
11+
1. Run `npm install rh-angular-rsa-form-validators` in your Angular project.
1312

14-
## Publishing
13+
2. Import and use the exposed classes to validate your Angular form controls.
1514

16-
After building your library with `ng build rh-rsa-form-validators`, go to the dist folder `cd dist/rh-rsa-form-validators` and run `npm publish`.
15+
# Usage
1716

18-
## Running unit tests
17+
TODO: Fill out usage section
1918

20-
Run `ng test rh-rsa-form-validators` to execute the unit tests via [Karma](https://karma-runner.github.io).
19+
# API Reference
2120

22-
## Further help
23-
24-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
21+
TODO: Fill out api reference section
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
}

projects/rh-rsa-form-validators/karma.conf.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)