banks-helper 2.0.2 → 2.1.1
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 +9 -16
- package/example/main.ts +22 -1
- package/example/transform-to-server.js +5 -0
- package/example/transform-to-server.js.map +1 -0
- package/example/transform-to-server.ts +3 -0
- package/index.html +1 -0
- package/index.ts +14 -7
- package/package.json +1 -1
- package/logos/interprogressbank.png +0 -0
- package/logos/otp_bank.png +0 -0
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: 'АКБ Абсолют Банк',
|
|
@@ -1006,7 +999,7 @@ export const banks: IBankLogoItem[] = [
|
|
|
1006
999
|
},
|
|
1007
1000
|
{
|
|
1008
1001
|
fileName: 'metallinvestbank.svg',
|
|
1009
|
-
humanName: 'Металлинвестбанк',
|
|
1002
|
+
humanName: 'АКБ Металлинвестбанк',
|
|
1010
1003
|
matchedBankNames: [
|
|
1011
1004
|
'PUBLIC JOINT STOCK COMPANY STOCK COMMERCIAL BANK "METALLURGICAL INVESTMENT BANK"',
|
|
1012
1005
|
'PJSC SCB "Metallinvestbank"',
|
|
@@ -2145,8 +2138,6 @@ export const banks: IBankLogoItem[] = [
|
|
|
2145
2138
|
'JSCB JSCB BINBANK',
|
|
2146
2139
|
'PUBLIC JOINT-STOCK COMPANY BANK OTKRITIE FINANCIAL CORPORATION',
|
|
2147
2140
|
'Открытие',
|
|
2148
|
-
'ОТП БАНК',
|
|
2149
|
-
// 'ПРИО-ВНЕШТОРГБАНК',
|
|
2150
2141
|
'ФК ОТКРЫТИЕ',
|
|
2151
2142
|
'Public Joint-Stock Company "Bank Otkritie Financial Corporation"',
|
|
2152
2143
|
'"Bank Otkritie Financial Corporation" (Public Joint-Stock Company)',
|
|
@@ -2399,11 +2390,6 @@ export const banks: IBankLogoItem[] = [
|
|
|
2399
2390
|
humanName: 'ЯРИНТЕРБАНК',
|
|
2400
2391
|
matchedBankNames: [],
|
|
2401
2392
|
},
|
|
2402
|
-
{
|
|
2403
|
-
fileName: 'interprogressbank.png',
|
|
2404
|
-
humanName: 'ИНТЕРПРОГРЕССБАНК',
|
|
2405
|
-
matchedBankNames: [],
|
|
2406
|
-
},
|
|
2407
2393
|
{
|
|
2408
2394
|
fileName: 'minbank.png',
|
|
2409
2395
|
humanName: 'Московский Индустриальный Банк',
|
|
@@ -2814,6 +2800,13 @@ export const banks: IBankLogoItem[] = [
|
|
|
2814
2800
|
humanName: 'Бакай Банк',
|
|
2815
2801
|
matchedBankNames: [],
|
|
2816
2802
|
},
|
|
2803
|
+
{
|
|
2804
|
+
fileName: 'mbank.svg',
|
|
2805
|
+
humanName: 'MBank',
|
|
2806
|
+
matchedBankNames: [
|
|
2807
|
+
'Коммерческий банк КЫРГЫЗСТАН',
|
|
2808
|
+
],
|
|
2809
|
+
},
|
|
2817
2810
|
{
|
|
2818
2811
|
fileName: 'dcb.svg',
|
|
2819
2812
|
humanName: 'Дос-Кредобанк',
|
|
@@ -2838,7 +2831,7 @@ export const banks: IBankLogoItem[] = [
|
|
|
2838
2831
|
fileName: 'rsk.svg',
|
|
2839
2832
|
humanName: 'РСК Банк',
|
|
2840
2833
|
matchedBankNames: [
|
|
2841
|
-
'Элдик Банк'
|
|
2834
|
+
'Элдик Банк',
|
|
2842
2835
|
],
|
|
2843
2836
|
},
|
|
2844
2837
|
{
|
package/example/main.ts
CHANGED
|
@@ -2,11 +2,32 @@ import { IBankLogoItem } from '../IBankLogoItem';
|
|
|
2
2
|
import { banks } from '../banks';
|
|
3
3
|
|
|
4
4
|
const bankTemplate: HTMLTemplateElement = document.querySelector('#bank');
|
|
5
|
+
const outputElement = document.querySelector('#result');
|
|
6
|
+
|
|
7
|
+
const x = banks.reduce((result, { matchedBankNames, humanName }) => {
|
|
8
|
+
humanName = humanName.replace(/"/g, '\\"');
|
|
9
|
+
|
|
10
|
+
if (matchedBankNames.length) {
|
|
11
|
+
matchedBankNames.forEach((bankName) => {
|
|
12
|
+
bankName = bankName.replace(/"/g, '\\"');
|
|
13
|
+
|
|
14
|
+
if (bankName.toUpperCase() !== humanName.toUpperCase()) {
|
|
15
|
+
result += `"${bankName.toUpperCase()}" => "${humanName}",\n`;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
result += `"${humanName.toUpperCase()}" => "${humanName}",\n`;
|
|
20
|
+
result += `\n`;
|
|
21
|
+
|
|
22
|
+
return result;
|
|
23
|
+
}, ``);
|
|
24
|
+
|
|
25
|
+
console.log(x);
|
|
5
26
|
|
|
6
27
|
const createBankLogoElement = ({ fileName, humanName, matchedBankNames }: IBankLogoItem) => {
|
|
7
28
|
const itemElement = bankTemplate.content.querySelector('.bank').cloneNode(true) as Element;
|
|
8
29
|
const imageElement: HTMLImageElement = itemElement.querySelector('.bank__logo');
|
|
9
|
-
imageElement.src ='logos/' + (fileName ? fileName : 'unknown.svg');
|
|
30
|
+
imageElement.src = 'logos/' + (fileName ? fileName : 'unknown.svg');
|
|
10
31
|
imageElement.alt = fileName;
|
|
11
32
|
|
|
12
33
|
if (!fileName) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-to-server.js","sourceRoot":"","sources":["transform-to-server.ts"],"names":[],"mappings":";;AAAA,kCAAiC;AAEjC,OAAO,CAAC,GAAG,CAAC,aAAK,CAAC,CAAC"}
|
package/index.html
CHANGED
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
|
};
|
package/package.json
CHANGED
|
Binary file
|
package/logos/otp_bank.png
DELETED
|
Binary file
|