Socket
Socket
Sign inDemoInstall

oversmash

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oversmash - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

27

build/scraper.js

@@ -203,6 +203,25 @@ 'use strict';

function extractCompetitiveRank(options, p) {
return normalizeValue(options, p('.masthead-player .competitive-rank .h5').text());
function extractCompetitiveRanks(options, p) {
// Role ranks don't appear to have identifying elements, so we must rely on the
// order they appear in the DOM
const roleRanks = p('.masthead-player-progression div.competitive-rank-level');
return {
tank: normalizeValue(options, roleRanks.eq(0).text()),
damage: normalizeValue(options, roleRanks.eq(1).text()),
support: normalizeValue(options, roleRanks.eq(2).text())
};
}
function extractEndorsementLevel(options, p) {
return normalizeValue(options, p('.EndorsementIcon-tooltip .u-center').first().text());
}
function extractGamesWon(options, p) {
const rawValue = p('.masthead-detail.h4 span').text();
// Remove 'X games won' trailing text
return normalizeValue(options, rawValue.replace(/[^0-9]/g, ''));
}
function gatherAchievements(options, p) {

@@ -227,3 +246,5 @@ const achievements = [];

stats.competitiveRank = extractCompetitiveRank(options, p);
stats.competitiveRank = extractCompetitiveRanks(options, p);
stats.endorsementLevel = extractEndorsementLevel(options, p);
stats.gamesWon = extractGamesWon(options, p);
stats.achievements = gatherAchievements(options, p);

@@ -230,0 +251,0 @@

@@ -0,1 +1,22 @@

# 1.5.0
1.5.0
- Adds support for role queue ranks in `playerStats` method
```json
{
stats: {
competitiveRank: {
support: 1234,
tank: 1234,
damage: 1234
}
}
}
```
- Adds `endorsementLevel` to `playerStats`
- Adds `gamesWon` to `playerStats`
# 1.4.0 & 1.4.1(May 14th 2019)

@@ -2,0 +23,0 @@

2

package.json
{
"name": "oversmash",
"version": "1.4.1",
"version": "1.5.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/filp/oversmash",

import assert from 'assert'
import oversmash from '../lib'
// Test names taken from masteroverwatch top lists at random. If you see yourself
// and would rather not be here, please open an issue!
async function testPlayerProfile (ow) {
const p = await ow.player('BOB#29739')
const p = await ow.player('FATCOTTON420#2476')
assert.equal(p.name, 'BOB-29739')
assert.equal(p.name, 'FATCOTTON420-2476')
assert.equal(p.accounts.length, 1)

@@ -15,9 +12,15 @@ }

async function testPlayerStats (ow) {
const p = await ow.playerStats('BOB-29739', 'pc')
const p = await ow.playerStats('FATCOTTON420-2476', 'pc')
assert.equal(p.name, 'BOB-29739')
assert.equal(p.name, 'FATCOTTON420-2476')
assert.equal(p.platform, 'pc')
assert(p.stats.endorsementLevel > 0)
assert(p.stats.gamesWon > 2000)
assert(p.stats.competitiveRank.tank > 0)
assert(p.stats.competitiveRank.damage > 0)
assert(p.stats.competitiveRank.support > 0)
// Make sure diacritics replacement is working as intended:
assert(p.stats.competitiveRank > 0)
assert(p.stats.quickplay.lucio.combat.all_damage_done > 0)

@@ -24,0 +27,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc