overtime-live-trading-utils 3.0.2-rc.2 → 4.0.0-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overtime-live-trading-utils",
3
- "version": "3.0.2-rc.2",
3
+ "version": "4.0.0-rc.0",
4
4
  "description": "",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -30,23 +30,12 @@ export const getBookmakersArray = (
30
30
  };
31
31
 
32
32
  export const getBookmakersFromLeagueConfig = (sportId: string | number, leagueInfoArray: LeagueConfigInfo[]) => {
33
- const uniqueBookmakers: string[] = [];
34
-
35
- for (const leagueInfo of leagueInfoArray) {
36
- if (Number(leagueInfo.sportId) === Number(sportId) && leagueInfo.enabled === 'true') {
37
- const primary = leagueInfo.primaryBookmaker?.toLowerCase();
38
- const secondary = leagueInfo.secondaryBookmaker?.toLowerCase();
39
- if (primary) {
40
- uniqueBookmakers.push(primary);
41
- }
42
- if (secondary && secondary !== primary) {
43
- uniqueBookmakers.push(secondary);
44
- }
45
- break;
46
- }
47
- }
33
+ const leagueInfoArrayFiltered: string[] = leagueInfoArray
34
+ .filter((leagueInfo) => Number(leagueInfo.sportId) === Number(sportId) && leagueInfo.enabled === 'true')
35
+ .flatMap((item) => [item.primaryBookmaker?.toLowerCase(), item.secondaryBookmaker?.toLowerCase()])
36
+ .filter((item): item is string => !!item && item.length > 0);
48
37
 
49
- return uniqueBookmakers;
38
+ return [...new Set(leagueInfoArrayFiltered)];
50
39
  };
51
40
 
52
41
  export const getBookmakersForLeague = (