Bin From Pan
The leading six digits of the card number used to be the "issuer identification number (IIN)", sometimes referred to as the "bank identification number (BIN)".
Now there are new BINs which take first 8 digits of card number. This small module differentiates between 8 digit pans and 6 digit pans. Right now it only detects 8 digit MIR pans but there can be more of those in future.
npm install bin-from-pan
const bin = ;
Function can throw errors if pan was not valid.