razorpay / ifsc

:bank: IFSC Codes Repository
https://ifsc.razorpay.com
MIT License
338 stars 129 forks source link

NPM package reports invalid IFSC incorrectly #170

Closed iAziz786 closed 4 years ago

iAziz786 commented 4 years ago

Hello, 👋 I have an IFSC number that is not currently being supported.

IDIB000J052

If agreed, I can also implement this.

thefoodiecoder commented 4 years ago

None of the Indian Bank IFSC codes are working when using the npm package while the same is available via the URL. The regex is wrong.

Correct Regex: /^[A-Za-z]{4}0[A-Z0-9a-z]{6}$/

captn3m0 commented 4 years ago

@thefoodiecoder Can you give an example please? Your regex will validate invalid IFSC codes, such as FAKE0FAKE00. The NPM package however ensures that only correct IFSCs are validated.

captn3m0 commented 4 years ago

IDIB000J052 is fixed in upcoming 1.5.1 release.

rohit-rapido commented 4 years ago

@captn3m0 This issue is not fixed yet in 1.5.1 The below code is still there

let isInteger = function(code) {
  if (isNaN(parseInt(code, 10))) {
    return false;
  }
  return true;
};

I see there is a code change in the main repo, which is not reflecting in the npm installed package

captn3m0 commented 4 years ago

I just pushed 1.5.1-1 with the regex variant. Should be fixed now.