show last 5 on amex

This commit is contained in:
Kyle Spearrin 2019-01-05 14:19:21 -05:00
parent 035b4e1dd5
commit 1542dd45d3
1 changed files with 4 additions and 1 deletions

View File

@ -47,7 +47,10 @@ export class CardView implements View {
} else {
this._subTitle = '';
}
this._subTitle += ('*' + this.number.substr(this.number.length - 4));
// Show last 5 on amex, last 4 for all others
const count = this.number.length >= 5 && this.number.match(new RegExp('^3[47]')) != null ? 5 : 4;
this._subTitle += ('*' + this.number.substr(this.number.length - count));
}
}
return this._subTitle;