league-wrapper
Version:
REST API Wrapper for the League of Legends API
26 lines (21 loc) • 626 B
JavaScript
;
const util = require('util');
const api = require('./index.js');
const name = 'Distinction';
api.summoner.getByNames(name).then(summoners => {
Object.keys(summoners).forEach(name => {
if (summoners.hasOwnProperty(name)) {
const summoner = summoners[name];
const summonerId = summoner.id;
api.league.getBySummonerIds(summonerId).then(function(data) {
console.log(data);
Object.keys(data).forEach(k => {
console.log(data[k][0].entries.length);
});
});
}
});
}).catch(error => {
util.log('Error fetching summoner');
util.log(error);
});