lion/packages/input-iban/src/parsers.js
Thomas Allmer ec8da8f12c feat: release inital public lion version
Co-authored-by: Mikhail Bashkirov <mikhail.bashkirov@ing.com>
Co-authored-by: Thijs Louisse <thijs.louisse@ing.com>
Co-authored-by: Joren Broekema <joren.broekema@ing.com>
Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com>
Co-authored-by: Erik Kroes <erik.kroes@ing.com>
Co-authored-by: Lars den Bakker <lars.den.bakker@ing.com>
2019-04-26 10:37:57 +02:00

12 lines
381 B
JavaScript

import { isValidIBAN } from '@bundled-es-modules/ibantools';
/**
* Parses an IBAN trimming spaces and making uppercase.
*
* @param {string} viewValue value to be parsed
* @return {string} parsed value
*/
export function parseIBAN(viewValue) {
const trimmedValue = viewValue.replace(/\s/g, '').toUpperCase();
return isValidIBAN(trimmedValue) ? trimmedValue : undefined;
}