@bisondesk/commons-sdk 1.0.661 → 1.0.663

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/src/vat.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A VAT number reduced to its comparable form: uppercase, with every separator (dots, spaces,
3
+ * dashes) stripped, so `be0762.732.774` and `BE 0762 732 774` both become `BE0762732774`.
4
+ *
5
+ * We normalise the same way for every country, on the assumption that a VAT number is only ever
6
+ * uppercase letters and digits.
7
+ */
8
+ export const normalizeVat = (input: string): string =>
9
+ input.replace(/[^a-zA-Z0-9]/g, '').toUpperCase();