open-index/open-npm huggingface dataset:
npm package: @mediaplatform/sportal365-odds-utils
Description: ### Installation
Author: smp@sportal.bg
Latest version: 1.2.2

# JavaScript Odds Utils

### Installation

Install Odds Utils dependency

```sh
npm install @mediaplatform/sportal365-odds-utils --save
```

or

```sh
yarn add @mediaplatform/sportal365-odds-utils
```

### Usage

Import Odds Utils dependency

```sh
import Core from "@mediaplatform/sportal365-odds-utils"
```

Initialize Odds Utils

```sh
const oddsUtils = new OddsUtils(odds, sport);
```

## Odds Service

Initialize service

```sh
const oddsService = oddsUtils(odds, sport);
```

**odds** - the argument is required (odds: any[]). **sport** - the argument is required (sport: string). (Example: "BASKETBALL","TENNIS")

### Usage 1

```sh
oddsService
  .mapOddsMarketsWithDifferentKeys()
  .get();
```

Corresponding output should be:

```sh
{
 	 odds: OddsModel
};
```

Service method

- **mapOddsMarketsWithDifferentKeys()** - Use this method to format the markets from array to object with type name keys.

- **filterOddsByConfig({ bettingId: string })**

  - bettingId - the argument is a string. If no bettingId is provided, the result will be filtered by the first provider from the response.

  ### Usage 2

```sh
oddsService
  .filterOddsByConfig({ bettingId: string })
  .get();
```

Corresponding output should be:

```sh
{
 	 odds: OddsModel
};
```

Service method

- **filterOddsByConfig({ bettingId: string })**

  - bettingId - the argument is a string. If no bettingId is provided, the result will be filtered by the first provider from the response.

- **get()** - the method is mandatory - Based on called methods, it returns the built object with all requested information for the odds and
  filtered odds by the given providers id

## Service Errors

If some data is not provided the corresponding service should return an error or warning message.

Example:

```sh
{
   oddsError: "Odds module initialization failed. You must provide an odds",
   (if the odds are missing),
   oddsWarning: "Odds module initialization failed. The odds array is empty.",
   (if the odds array is empty)
   ...
}
```
npm package: @mediaplatform/sportal365-playoff-utils
Description: ### Installation
Author: smp@sportal.bg
Latest version: 1.0.16

# JavaScript Playoff Utils

### Installation

Install Playoff Utils dependency

```sh
npm install @mediaplatform/sportal365-playoff-utils --save
```

or

```sh
yarn add @mediaplatform/sportal365-playoff-utils
```

### Usage

Import Playoff Utils dependency

```sh
import PlayoffUtils from "@mediaplatform/sportal365-playoff-utils"
```

Initialize Playoff Utils

```sh
const playoffUtils = new PlayoffUtils(sport, configObj);
```

## Playoff Service

Initialize service

```sh
const playoffService = PlayoffUtils(sport, configObj);
```

**sport** - the argument is required (sport: string). (Example: "basketball","tennis") **configObj** - the argument is required (configObj:
Object). (Example: { apiUrl: 'https://playoffs.api.integration.sportal365.com/playoffs', authorization: 'Basic XXXX', stageId: 'XXX-XX-XX',
project: 'sportal' })

### ** Usage 1**

```sh
playoffService
	.get();
```

Corresponding output should be:

```sh
{
 	 playoff: ResponseModel
};
```

### ** Usage 2**

```sh
playoffService
	.formatPlayoff()
	.get();
```

Corresponding output should be:

```sh
{
 	 playoff: RemappedStageModel
};
```

### ** Usage 3**

```sh
playoffService
	.formatPlayoff()
	.formatRounds()
	.get();
```

Corresponding output should be:

```sh
{
 	 playoff: RemappedStageModel
};
```

Service method

- **formatPlayoff()** - the method is NOT mandatory - It's formatting the api call response

- **formatRounds()** - the method is NOT mandatory - It's formatting the rounds array into an object with round name keys.

- **get()** - the method is mandatory - Based on called methods, it returns the built object with all requested information for the playoff

## Service Errors

If some data is not provided the corresponding service should return an error or warning message.

Example:

```sh
{
	NOT_VALID_SPORT = 'Playoff module initialization failed. You must provide valid sport.',
	NOT_VALID_CONFIGURATION_OBJECT = 'Playoff module initialization failed. You must provide valid configuration object.',
	NO_AUTHORIZATION_DATA = 'Playoff module initialization failed. You must provide authorization data.',
	NO_PROJECT_DATA = 'Playoff module initialization failed. You must provide project config data.',
	NO_TOURNAMENT_DATA = 'Playoff module initialization failed. You must provide competition config data (competitionId and status) or stageId.',
	NO_API_URL = 'Playoff module initialization failed. You must provide playoff api url.',
}
```