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
(function() { | |
'use strict'; | |
/** | |
* Formats a string and returns a valid IBAN account string | |
* @param {string} input example: 'ES0123456789012345678901' | |
* @return {string} output example: 'ES01 2345 6789 0123 4567 8901' | |
* @example <caption>{{'ES0123456789012345678901' | IBAN}}</caption> | |
*/ | |
angular.module('app').filter('IBAN', () => iban => iban ? iban.replace(/[^\dA-Z]/g, '').replace(/(.{4})/g, '$1 ').trim() : ''); |