Comparing version 4.2.2 to 4.3.2
{ | ||
"name": "fortnite", | ||
"version": "4.2.2", | ||
"version": "4.3.2", | ||
"description": "An API wrapper, for Fortnite, around the FortniteTracker API.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ const fetch = require('node-fetch'); | ||
// Handling Player Not Found error | ||
if (data.error === 'Player Not Found') return { code: 404, error: data.error }; | ||
if (data.error === 'Player Not Found') return { code: 404, error: 'Player Not Found' }; | ||
// Handling any other error | ||
@@ -46,0 +46,0 @@ else if (data.error) return data; |
@@ -25,4 +25,3 @@ const Mode = require('./Mode'); | ||
// TODO: Make a single object rather than an array of objects, for both. | ||
this.stats.lifetime = profile.lifeTimeStats.map(stat => new Stat(stat)); | ||
this.stats.lifetime = profile.lifeTimeStats.map(stat => new Stat(stat)).reduce((a, b) => ({ ...a, ...b })); | ||
this.stats.recent = profile.recentMatches.map(game => new Game(game)); | ||
@@ -29,0 +28,0 @@ } |
@@ -11,4 +11,17 @@ /** | ||
constructor(stat) { | ||
this[stat.key.split(' ').join('_')] = stat.value; | ||
stat.value = Number(stat.value); | ||
switch (stat.key) { | ||
case 'Score': this.score = stat.value; break; | ||
case 'K/d': this.kd = stat.value; break; | ||
case 'Matches Played': this.matches = stat.value; break; | ||
case 'Kills': this.kills = stat.value; break; | ||
case 'Wins': this.wins = stat.value; break; | ||
case 'Top 3s': this.top_3 = stat.value; break; | ||
case 'Top 5s': this.top_5 = stat.value; break; | ||
case 'Top 6s': this.top_6 = stat.value; break; | ||
case 'Top 12s': this.top_12 = stat.value; break; | ||
case 'Top 25s': this.top_25 = stat.value; break; | ||
} | ||
} | ||
}; |
@@ -11,3 +11,2 @@ /** | ||
constructor(store) { | ||
// TODO: Make a single object rather than an array of objects. | ||
this.id = store.manifestId; | ||
@@ -14,0 +13,0 @@ this.name = store.name; |
const Client = require('../'); | ||
const fortnite = new Client('Key'); | ||
const fortnite = new Client(require('./config').Token); | ||
@@ -12,5 +12,5 @@ (async () => { | ||
console.log(user); | ||
console.log(user, store, challenges); | ||
})(); | ||
process.on('unhandledRejection', console.error); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8694
12
217