Created
February 25, 2020 22:05
-
-
Save kdssoftware/4ad538e613006148f1a30093f943705a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.formatBEVat=(vat)=> { | |
//remove dots | |
let currentVat = vat.replace(/\.+/g,''); | |
//remove letters | |
currentVat = currentVat.replace(/[A-Za-z]/g,''); | |
//remove whitespace | |
currentVat = currentVat.trim(); | |
let finalVat = ""; | |
finalVat = "BE"+currentVat.substring(0,4)+"."+currentVat.substring(4,7)+"."+currentVat.substring(7,10); | |
return finalVat; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment