<commit_before><p align="center">
    <a href="#"><img src="https://user-images.githubusercontent.com/14541442/32552867-3d44fd8e-c4d0-11e7-85d5-5199697582bd.png"></a>
</p>

<p align="center">
A powerful and light PlayerUnknown's Battlegrounds stats API wrapper,<br/>for Node.js and for the web.
</p>

<p align="center">
  <a href="https://travis-ci.org/ickerio/pubg.js">
    <img src="https://travis-ci.org/ickerio/pubg.js.svg?branch=master">
  </a>
  <a href="https://www.npmjs.com/package/pubg.js">
    <img src="https://img.shields.io/npm/dt/pubg.js.svg?maxAge=3600">
  </a>
  <a href="./package.json">
    <img src="https://img.shields.io/david/ickerio/pubg.js.svg?maxAge=3600">
  </a>
</p>

###### [Wrapper Documentation](https://ickerio.github.io/pubg.js/) | [API Documentation](https://documentation.playbattlegrounds.com/en/introduction.html) | [Changelog](CHANGELOG.md) | [Issues](#issues)


pubg.js makes it easy to interact with [the pubg dev api](https://developer.playbattlegrounds.com/). Written with an intelligent and performant api, making it easy for anyone to access a massive database of pubg data, including players stats, matches, teams, events of matches and much more. Built with customizable caching, for maximum performance, and quicker data retrieval. 

# Setup and Installation
1. Signup at [the pubg dev api site](https://developer.playbattlegrounds.com/)
2. Register an [app](https://developer.playbattlegrounds.com/apps/new?locale=en), giving you a key
3. Install **pubg.js** `npm install pubg.js --save`
4. When using the wrapper, parse your generated key when creating the client


# Examples
```js
// Require model and initiate client with api key
const pubg = require('pubg.js');
const client = new pubg.Client('yourKey');

// Get a single player using their name
const player = client.getPlayer({name: 'yeye155'})
    .then(player => /* Use an extensive class of data */)
    .catch(error => /* Catch any errors */)

// Retrieve thousands of recent matches, and get stats for any of them
const player = client.getSamples()
    .then(matches => /* Have access to the PUBG's extensive list of matches */)
    .catch(error => /* Catch any errors */)

// Fetch a match with a heap of data on every participant of the match and their stats
const player = client.getSamples()
    .then(match => {
        // Manipulate the data in any way you like, or even get match telemetry data 
        match.fetchTelemetry()
        // View a heap of data on the teams - best k/d, winning team etc
        match.relationships.rosters

    })
    .catch(error => /* Catch any errors */)

```

# Web
> Currently untested in v3<commit_msg>Add ‘region’ parameter to example<commit_after><p align="center">
    <a href="#"><img src="https://user-images.githubusercontent.com/14541442/32552867-3d44fd8e-c4d0-11e7-85d5-5199697582bd.png"></a>
</p>

<p align="center">
A powerful and light PlayerUnknown's Battlegrounds stats API wrapper,<br/>for Node.js and for the web.
</p>

<p align="center">
  <a href="https://travis-ci.org/ickerio/pubg.js">
    <img src="https://travis-ci.org/ickerio/pubg.js.svg?branch=master">
  </a>
  <a href="https://www.npmjs.com/package/pubg.js">
    <img src="https://img.shields.io/npm/dt/pubg.js.svg?maxAge=3600">
  </a>
  <a href="./package.json">
    <img src="https://img.shields.io/david/ickerio/pubg.js.svg?maxAge=3600">
  </a>
</p>

###### [Wrapper Documentation](https://ickerio.github.io/pubg.js/) | [API Documentation](https://documentation.playbattlegrounds.com/en/introduction.html) | [Changelog](CHANGELOG.md) | [Issues](#issues)


pubg.js makes it easy to interact with [the pubg dev api](https://developer.playbattlegrounds.com/). Written with an intelligent and performant api, making it easy for anyone to access a massive database of pubg data, including players stats, matches, teams, events of matches and much more. Built with customizable caching, for maximum performance, and quicker data retrieval. 

# Setup and Installation
1. Signup at [the pubg dev api site](https://developer.playbattlegrounds.com/)
2. Register an [app](https://developer.playbattlegrounds.com/apps/new?locale=en), giving you a key
3. Install **pubg.js** `npm install pubg.js --save`
4. When using the wrapper, parse your generated key when creating the client


# Examples
```js
// Require model and initiate client with api key
const pubg = require('pubg.js');
const client = new pubg.Client('yourKey', 'region');

// Get a single player using their name
const player = client.getPlayer({name: 'yeye155'})
    .then(player => /* Use an extensive class of data */)
    .catch(error => /* Catch any errors */)

// Retrieve thousands of recent matches, and get stats for any of them
const player = client.getSamples()
    .then(matches => /* Have access to the PUBG's extensive list of matches */)
    .catch(error => /* Catch any errors */)

// Fetch a match with a heap of data on every participant of the match and their stats
const player = client.getSamples()
    .then(match => {
        // Manipulate the data in any way you like, or even get match telemetry data 
        match.fetchTelemetry()
        // View a heap of data on the teams - best k/d, winning team etc
        match.relationships.rosters

    })
    .catch(error => /* Catch any errors */)

```

# Web
> Currently untested in v3
{'fraction_non_alphanumeric': 0.14101123595505619, 'fraction_numerical': 0.020224719101123594, 'mean_word_length': 3.78584229390681, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 55, 'https://': 22, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2384857', 'n_tokens_mistral': 1804, 'n_tokens_neox': 1677, 'n_words': 536}