blob: 7fd355efdefa62bc989438c5c47a23c5ad43e082 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import assert from 'assert';
/**
* Format account number
* @param {string} val account number
*/
export const formatAccount = (val) => {
assert(typeof(val) === 'string', 'account number must be a string');
// display number altogether when longer than 12
if(val.length > 12) {
return val;
}
// display quartets
return val.replace(/([0-9]{4})/g, '$1 ').trim();
};
|