@thisisagile/easy-domain 17.20.7 → 17.21.0
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/dist/index.d.ts +1 -0
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/values/VAT.d.ts +7 -0
- package/dist/values/VAT.mjs +29 -0
- package/dist/values/VAT.mjs.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/values/VAT.ts +20 -0
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './enums/Country';\nexport * from './enums/Currency';\nexport * from './enums/Locale';\nexport * from './enums/UnitOfMeasurement';\nexport * from './enums/UnitOfWeight';\n\nexport * from './structs/Address';\nexport * from './structs/Box';\nexport * from './structs/Dimension';\nexport * from './structs/Money';\nexport * from './structs/Name';\nexport * from './structs/Weight';\n\nexport * from './values/EAN';\nexport * from './values/Email';\nexport * from './values/IBAN';\nexport * from './values/DunsNumber';\nexport * from './values/PostalCode';\nexport * from './values/Slug';\nexport * from './values/Url';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './enums/Country';\nexport * from './enums/Currency';\nexport * from './enums/Locale';\nexport * from './enums/UnitOfMeasurement';\nexport * from './enums/UnitOfWeight';\n\nexport * from './structs/Address';\nexport * from './structs/Box';\nexport * from './structs/Dimension';\nexport * from './structs/Money';\nexport * from './structs/Name';\nexport * from './structs/Weight';\n\nexport * from './values/EAN';\nexport * from './values/Email';\nexport * from './values/IBAN';\nexport * from './values/DunsNumber';\nexport * from './values/PostalCode';\nexport * from './values/Slug';\nexport * from './values/Url';\nexport * from './values/VAT';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_validator
|
|
3
|
+
} from "../chunk-CF2KLUD7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__toESM
|
|
6
|
+
} from "../chunk-RDITZTSA.mjs";
|
|
7
|
+
|
|
8
|
+
// src/values/VAT.ts
|
|
9
|
+
var import_validator = __toESM(require_validator());
|
|
10
|
+
import { isNotEmpty, text, Value } from "@thisisagile/easy";
|
|
11
|
+
var VAT = class extends Value {
|
|
12
|
+
country;
|
|
13
|
+
constructor(vat2, country = "NL") {
|
|
14
|
+
const cleaned = text(vat2).trim.replace(".", "").toString();
|
|
15
|
+
super(cleaned);
|
|
16
|
+
this.country = text(country).trim.upper.toString();
|
|
17
|
+
}
|
|
18
|
+
get isValid() {
|
|
19
|
+
if (!isNotEmpty(this.value))
|
|
20
|
+
return false;
|
|
21
|
+
return (0, import_validator.isVAT)(this.value, this.country);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var vat = (v, country) => new VAT(v, country);
|
|
25
|
+
export {
|
|
26
|
+
VAT,
|
|
27
|
+
vat
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=VAT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/values/VAT.ts"],"sourcesContent":["import { isNotEmpty, text, Value } from '@thisisagile/easy';\nimport { isVAT } from 'validator';\n\nexport class VAT extends Value {\n private readonly country: string;\n\n constructor(vat: unknown, country = 'NL') {\n const cleaned = text(vat).trim.replace('.', '').toString();\n super(cleaned);\n\n this.country = text(country).trim.upper.toString();\n }\n\n get isValid(): boolean {\n if (!isNotEmpty(this.value)) return false;\n return isVAT(this.value, this.country);\n }\n}\n\nexport const vat = (v: unknown, country?: string): VAT => new VAT(v, country);\n"],"mappings":";;;;;;;;AACA,uBAAsB;AADtB,SAAS,YAAY,MAAM,aAAa;AAGjC,IAAM,MAAN,cAAkB,MAAM;AAAA,EACZ;AAAA,EAEjB,YAAYA,MAAc,UAAU,MAAM;AACxC,UAAM,UAAU,KAAKA,IAAG,EAAE,KAAK,QAAQ,KAAK,EAAE,EAAE,SAAS;AACzD,UAAM,OAAO;AAEb,SAAK,UAAU,KAAK,OAAO,EAAE,KAAK,MAAM,SAAS;AAAA,EACnD;AAAA,EAEA,IAAI,UAAmB;AACrB,QAAI,CAAC,WAAW,KAAK,KAAK;AAAG,aAAO;AACpC,eAAO,wBAAM,KAAK,OAAO,KAAK,OAAO;AAAA,EACvC;AACF;AAEO,IAAM,MAAM,CAAC,GAAY,YAA0B,IAAI,IAAI,GAAG,OAAO;","names":["vat"]}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isNotEmpty, text, Value } from '@thisisagile/easy';
|
|
2
|
+
import { isVAT } from 'validator';
|
|
3
|
+
|
|
4
|
+
export class VAT extends Value {
|
|
5
|
+
private readonly country: string;
|
|
6
|
+
|
|
7
|
+
constructor(vat: unknown, country = 'NL') {
|
|
8
|
+
const cleaned = text(vat).trim.replace('.', '').toString();
|
|
9
|
+
super(cleaned);
|
|
10
|
+
|
|
11
|
+
this.country = text(country).trim.upper.toString();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get isValid(): boolean {
|
|
15
|
+
if (!isNotEmpty(this.value)) return false;
|
|
16
|
+
return isVAT(this.value, this.country);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const vat = (v: unknown, country?: string): VAT => new VAT(v, country);
|