diff --git a/bower.json b/bower.json index dcbd5ac..26bcb36 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ng-iban", - "version": "0.9.0", + "version": "1.0.0", "authors": [ "Mark Manders " ], diff --git a/dist/ng-iban.js b/dist/ng-iban.js index 1e31eb1..273b945 100644 --- a/dist/ng-iban.js +++ b/dist/ng-iban.js @@ -108,6 +108,28 @@ }); } }; + }).filter('iban', function () { + return function (string, separator) { + var isValidIban, parseIban, valid; + parseIban = function parseIban(value) { + if (value != null) { + return value.toUpperCase().replace(/\s/g, ''); + } else { + return void 0; + } + }; + isValidIban = function isValidIban(value) { + var iban; + iban = parseIban(value); + return IBAN.isValid(iban); + }; + valid = isValidIban(string); + if (valid) { + return IBAN.printFormat(string, separator); + } else { + return string; + } + }; }); /***/ }, diff --git a/lib/ng-iban.js b/lib/ng-iban.js index c7dcb9d..32c5a45 100644 --- a/lib/ng-iban.js +++ b/lib/ng-iban.js @@ -61,4 +61,26 @@ angular.module('mm.iban', ['ng']).directive('ngIban', function() { }); } }; +}).filter('iban', function() { + return function(string, separator) { + var isValidIban, parseIban, valid; + parseIban = function(value) { + if (value != null) { + return value.toUpperCase().replace(/\s/g, ''); + } else { + return void 0; + } + }; + isValidIban = function(value) { + var iban; + iban = parseIban(value); + return IBAN.isValid(iban); + }; + valid = isValidIban(string); + if (valid) { + return IBAN.printFormat(string, separator); + } else { + return string; + } + }; }); diff --git a/package.json b/package.json index de6b647..e061e4e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng-iban", - "version": "0.9.0", + "version": "1.0.0", "description": "IBAN directive for AngularJS", "main": "./lib/ng-iban.js", "scripts": {