@medipass/utils 11.71.1-feature-abn-validators.1 → 11.71.1-feature-abn-validators.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/lib/normalise-abn.d.ts +0 -2
- package/normalise-abn.js +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "11.71.1-feature-abn-validators.
|
|
3
|
+
"version": "11.71.1-feature-abn-validators.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"rimraf": "^2.6.2",
|
|
52
52
|
"typescript": "4.8.4"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "b16c45ca45114d58aa4331800cfb659f151d2c19"
|
|
55
55
|
}
|
package/lib/normalise-abn.d.ts
DELETED
package/normalise-abn.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var ABN_LENGTH = 11;
|
|
6
|
-
var ACN_LENGTH = 9;
|
|
7
|
-
var normaliseAbn = (function (abn) {
|
|
8
|
-
var trimmedABN = abn && abn.replace(/\s/g, ''); // The input is an ABN, in which case the format should be 99 999 999 999
|
|
9
|
-
|
|
10
|
-
if (trimmedABN.length === ABN_LENGTH) {
|
|
11
|
-
return trimmedABN.substring(0, 2) + ' ' + trimmedABN.substring(2, 5) + ' ' + trimmedABN.substring(5, 8) + ' ' + trimmedABN.substring(8);
|
|
12
|
-
} //The input is an ACN, in which case the format should be 999 999 999
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (trimmedABN.length === ACN_LENGTH) {
|
|
16
|
-
return trimmedABN.substring(0, 3) + ' ' + trimmedABN.substring(3, 6) + ' ' + trimmedABN.substring(6);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return abn;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
exports.default = normaliseAbn;
|