From 1542dd45d36e3f6ab3684be0a83bef663ba987af Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 5 Jan 2019 14:19:21 -0500 Subject: [PATCH] show last 5 on amex --- src/models/view/cardView.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/models/view/cardView.ts b/src/models/view/cardView.ts index 1630c674821..df3497c96ce 100644 --- a/src/models/view/cardView.ts +++ b/src/models/view/cardView.ts @@ -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;