banks-helper 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/banks.ts +8 -8
- package/index.ts +14 -7
- package/package.json +1 -1
package/banks.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { IBankLogoItem } from './IBankLogoItem';
|
|
2
2
|
|
|
3
3
|
export const banks: IBankLogoItem[] = [
|
|
4
|
-
{
|
|
5
|
-
fileName: 'mbank.svg',
|
|
6
|
-
humanName: 'MBank',
|
|
7
|
-
matchedBankNames: [
|
|
8
|
-
'Коммерческий банк КЫРГЫЗСТАН'
|
|
9
|
-
],
|
|
10
|
-
},
|
|
11
4
|
{
|
|
12
5
|
fileName: 'absolutbank.svg',
|
|
13
6
|
humanName: 'АКБ Абсолют Банк',
|
|
@@ -2814,6 +2807,13 @@ export const banks: IBankLogoItem[] = [
|
|
|
2814
2807
|
humanName: 'Бакай Банк',
|
|
2815
2808
|
matchedBankNames: [],
|
|
2816
2809
|
},
|
|
2810
|
+
{
|
|
2811
|
+
fileName: 'mbank.svg',
|
|
2812
|
+
humanName: 'MBank',
|
|
2813
|
+
matchedBankNames: [
|
|
2814
|
+
'Коммерческий банк КЫРГЫЗСТАН',
|
|
2815
|
+
],
|
|
2816
|
+
},
|
|
2817
2817
|
{
|
|
2818
2818
|
fileName: 'dcb.svg',
|
|
2819
2819
|
humanName: 'Дос-Кредобанк',
|
|
@@ -2838,7 +2838,7 @@ export const banks: IBankLogoItem[] = [
|
|
|
2838
2838
|
fileName: 'rsk.svg',
|
|
2839
2839
|
humanName: 'РСК Банк',
|
|
2840
2840
|
matchedBankNames: [
|
|
2841
|
-
'Элдик Банк'
|
|
2841
|
+
'Элдик Банк',
|
|
2842
2842
|
],
|
|
2843
2843
|
},
|
|
2844
2844
|
{
|
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IBankLogoItem } from './IBankLogoItem';
|
|
|
3
3
|
|
|
4
4
|
const UNKNOWN_BANK_FILE_NAME = 'unknown.svg';
|
|
5
5
|
|
|
6
|
-
const findBank = (bankName: string, banksList: IBankLogoItem[] = banks): IBankLogoItem => {
|
|
6
|
+
const findBank = (bankName: string, banksList: IBankLogoItem[] = banks, isExact = true): IBankLogoItem => {
|
|
7
7
|
if (!bankName) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
@@ -11,19 +11,26 @@ const findBank = (bankName: string, banksList: IBankLogoItem[] = banks): IBankLo
|
|
|
11
11
|
const lowerBankName = bankName.toLowerCase();
|
|
12
12
|
|
|
13
13
|
return banksList.find(({ matchedBankNames, humanName }) => {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const lowerBankNames = Array.from([...matchedBankNames, humanName], it => it.toLowerCase());
|
|
15
|
+
|
|
16
|
+
return lowerBankNames.some(it => {
|
|
17
|
+
if (isExact) {
|
|
18
|
+
return it === lowerBankName;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return it.includes(lowerBankName);
|
|
22
|
+
});
|
|
16
23
|
});
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
const getBankLogoFileName = (bankName: string, banksList: IBankLogoItem[] = banks) => {
|
|
20
|
-
const bankLogoItem = findBank(bankName, banksList);
|
|
26
|
+
const getBankLogoFileName = (bankName: string, banksList: IBankLogoItem[] = banks, isExact = true) => {
|
|
27
|
+
const bankLogoItem = findBank(bankName, banksList, isExact);
|
|
21
28
|
|
|
22
29
|
return bankLogoItem?.fileName || UNKNOWN_BANK_FILE_NAME;
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
const getBankLogoName = (bankName: string, banksList: IBankLogoItem[] = banks): string => {
|
|
26
|
-
const bankLogoItem = findBank(bankName, banksList);
|
|
32
|
+
const getBankLogoName = (bankName: string, banksList: IBankLogoItem[] = banks, isExact = true): string => {
|
|
33
|
+
const bankLogoItem = findBank(bankName, banksList, isExact);
|
|
27
34
|
|
|
28
35
|
return bankLogoItem?.humanName || bankName;
|
|
29
36
|
};
|