1.0.1 • Published 5 years ago
frag.js v1.0.1
Installation
npm i frag.js
At least Node.js v14 is required
About
frag.js
is an easy-to-use module which allows you to request data from the public FRAG API with an object oriented style, written in TypeScript.
Documentation
For now, typings
Examples
Example Player
object:
Player {
id: '93506706-fec2-8b08-4f8e-66a286914306',
score: 18132,
rank: 47,
country: 'it',
name: '[00fff7]༺[00e8fa]L[00d2fc]a[00bbff]z[00d2fc]z[00e8fa]a[00fff7]༻ ',
level: 11,
strippedName: '༺lazza༻ ',
clanName: '[0070ff]R[007fff]i[008eff]s[009dff]e [00baff]o[00c9ff]f [00b9ff]G[00b2ff]O[00aaff]D[00a2ff]S'
}
Example Clan
object:
Clan {
id: '13886ab1-e221-8b08-cfce-3f8fdb2c1813',
score: 119080,
rank: 18,
country: 'us',
name: 'Cat destroyer',
tag: 'CD!',
strippedName: 'cat destroyer',
members: [] // needs to be fetched manually
}
Example:
const { Client } = require('frag.js');
const api = new Client();
api.players.fetch('༺lazza༻ ').then(console.log); // fetch a player by name, colors or caps don't matter
api.players.fetch().then(console.log); // fetch top 1000 players
api.clans.fetch('Cat destroyer').then(console.log); // fetch a clan by name, colors or caps don't matter
api.clans.fetch().then(console.log); // fetch top 1000 clans
For more examples, see the test folder