Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create getDomainCards #27484

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ const CONST = {
SMALL_NORMAL: 'small-normal',
},
EXPENSIFY_CARD: {
BANK: 'Expensify Card',
FRAUD_TYPES: {
DOMAIN: 'domain',
INDIVIDUAL: 'individal',
Expand Down
12 changes: 11 additions & 1 deletion src/libs/CardUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {Card} from '../types/onyx';
import CONST from '../CONST';

/**
* @returns string with a month in MM format
*/
Expand All @@ -15,4 +18,11 @@ function getYearFromExpirationDateString(expirationDateString: string) {
return cardYear.length === 2 ? `20${cardYear}` : cardYear;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Are we no longer adding JSDocs for TS? I've noticed some other TS functions have them.

export {getMonthFromExpirationDateString, getYearFromExpirationDateString};
function getCompanyCards(cardList: {string: Card}) {
if (!cardList) {
return [];
}
return Object.values(cardList).filter((card) => card.bank !== CONST.EXPENSIFY_CARD.BANK);
}

export {getMonthFromExpirationDateString, getYearFromExpirationDateString, getCompanyCards};
Loading