From 5a699e4e04a925e0d9c4eedcad1b38c887249314 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Tue, 13 Mar 2018 14:27:50 +0100 Subject: [PATCH 1/2] iban - Fix incorrect function signatures Here is the code for the two functions of iban@1.3.0: https://github.com/arhs/iban.js/blob/master/iban.js#L359 /** * Convert an IBAN to a BBAN. * * @param iban * @param {String} [separator] the separator to use between the blocks of the BBAN, defaults to ' ' * @returns {string|*} */ exports.toBBAN = function(iban, separator){ if (typeof separator == 'undefined'){ separator = ' '; } iban = electronicFormat(iban); var countryStructure = countries[iban.slice(0,2)]; if (!countryStructure) { throw new Error('No country with code ' + iban.slice(0,2)); } return countryStructure.toBBAN(iban, separator); }; exports.printFormat = function(iban, separator){ if (typeof separator == 'undefined'){ separator = ' '; } return electronicFormat(iban).replace(EVERY_FOUR_CHARS, "$1" + separator); }; --- types/iban/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/iban/index.d.ts b/types/iban/index.d.ts index a47cfa618f..2b14d73954 100644 --- a/types/iban/index.d.ts +++ b/types/iban/index.d.ts @@ -42,17 +42,17 @@ interface IBANStatic { /** * @summary Returns the IBAN in a print format. * @param {string} iban The IBAN to convert. - * @param {string} The IBAN in print format. + * @param {string} separator The separator to use between IBAN blocks, defaults to ' '. */ - printFormat(iban: string, separator: string[]): string; + printFormat(iban: string, separator?: string): string; /** * @summary Convert the passed IBAN to a country-specific BBAN. * @param {string} iban The IBAN to convert. - * @param {string[]} Separator the separator to use between BBAN blocks. + * @param {string} separator The separator to use between BBAN blocks, defaults to ' '. * @returns {string} The BBAN */ - toBBAN(iban: string, separator: string[]): string; + toBBAN(iban: string, separator?: string): string; } declare var IBAN: IBANStatic; From d06ca98a8d9bd46dfa1a7776096e0de07fa3a64c Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Wed, 14 Mar 2018 09:31:28 +0100 Subject: [PATCH 2/2] Update iban-tests.ts --- types/iban/iban-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/iban/iban-tests.ts b/types/iban/iban-tests.ts index ac79e97a99..574769c461 100644 --- a/types/iban/iban-tests.ts +++ b/types/iban/iban-tests.ts @@ -39,7 +39,7 @@ function testIsValidBBAN() { */ function testPrintFormat() { var iban: string = 'BE68539007547034'; - var separator: string[] = ['fr']; + var separator: string = ' '; var format: string = IBAN.printFormat(iban, separator); } @@ -48,6 +48,6 @@ function testPrintFormat() { */ function testToBBAN() { var iban: string = 'BE68539007547034'; - var separator: string[] = ['-']; + var separator: string = '-'; var bban: string = IBAN.toBBAN(iban, separator); -} \ No newline at end of file +}