Compare commits

..

5 Commits

Author SHA1 Message Date
maxswa
eebf76a34c v2.8.0 2022-04-18 15:50:35 -04:00
Max Swartwout
e60442a7ce Merge pull request #50 from maxswa/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-04-18 15:47:45 -04:00
Max Swartwout
1132a085e1 Merge pull request #52 from molo-pl/main
Add support for Rifts Closed
2022-04-18 15:47:35 -04:00
molo-pl
a2a34a46e3 Add support for Rifts Closed 2022-04-15 11:30:56 +02:00
dependabot[bot]
71a76a12fd Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 13:26:44 +00:00
6 changed files with 12 additions and 30 deletions

View File

@@ -88,7 +88,7 @@ test('Parse CSV to json', () => {
1,6143
4814,898
37,225
23,467
25,1110
382,2780
944,3000
1981,1452
@@ -172,7 +172,7 @@ test('Parse CSV to json', () => {
},
lastManStanding: { rank: 4814, score: 898 },
soulWarsZeal: { rank: 37, score: 225 },
riftsClosed: { rank: 23, score: 467 },
riftsClosed: { rank: 25, score: 1110 },
clues: {
all: { rank: 32, score: 12148 },
beginner: { rank: 3105, score: 76 },
@@ -238,11 +238,9 @@ test('Parse CSV to json', () => {
});
test('Parse CSV with unknown activity', () => {
const statsWithUnknownActivity = `${lynxTitanStats}
const statsWithUnknownActivity = lynxTitanStats + `
-1,-1`;
expect(() => parseStats(statsWithUnknownActivity)).toThrow(
INVALID_FORMAT_ERROR
);
expect(() => parseStats(statsWithUnknownActivity)).toThrow(INVALID_FORMAT_ERROR);
});
test('Parse invalid CSV', () => {

View File

@@ -29,7 +29,6 @@
-1,-1
-1,-1
-1,-1
-1,-1
347584,22
-1,-1
-1,-1
@@ -82,4 +81,5 @@
-1,-1
-1,-1
-1,-1
-1,-1
-1,-1
Can't render this file because it has a wrong number of fields in line 25.

View File

@@ -1,6 +1,6 @@
{
"name": "osrs-json-hiscores",
"version": "2.7.0",
"version": "2.8.0",
"description": "The Old School Runescape API wrapper that does more!",
"main": "lib/index.js",
"types": "lib/index.d.ts",

View File

@@ -28,8 +28,7 @@ import {
getActivityPageURL,
httpGet,
BOSSES,
INVALID_FORMAT_ERROR,
EXTRA_ACTIVITY_COUNT
INVALID_FORMAT_ERROR
} from './utils';
/**
@@ -76,14 +75,7 @@ export function parseStats(csv: string): Stats {
.filter((entry) => !!entry)
.map((stat) => stat.split(','));
if (
splitCSV.length !==
SKILLS.length +
BH_MODES.length +
CLUES.length +
BOSSES.length +
EXTRA_ACTIVITY_COUNT
) {
if (splitCSV.length !== SKILLS.length + BH_MODES.length + CLUES.length + BOSSES.length + 4) {
throw Error(INVALID_FORMAT_ERROR);
}
@@ -113,10 +105,7 @@ export function parseStats(csv: string): Stats {
const [leaguePoints] = activityObjects.splice(0, 1);
const bhObjects = activityObjects.splice(0, BH_MODES.length);
const clueObjects = activityObjects.splice(0, CLUES.length);
const [lastManStanding, soulWarsZeal, riftsClosed] = activityObjects.splice(
0,
3
);
const [lastManStanding, soulWarsZeal, riftsClosed] = activityObjects.splice(0, 3);
const bossObjects = activityObjects.splice(0, BOSSES.length);
const skills: Skills = skillObjects.reduce<Skills>((prev, curr, index) => {

View File

@@ -250,9 +250,4 @@ export const FORMATTED_SOUL_WARS = 'Soul Wars Zeal';
export const FORMATTED_LEAGUE_POINTS = 'League Points';
export const FORMATTED_RIFTS_CLOSED = 'Rifts Closed';
/**
* Count of activities not including bosses, bounty hunter, or clues.
*/
export const EXTRA_ACTIVITY_COUNT = 4;
export const INVALID_FORMAT_ERROR = 'Invalid hiscores format';

View File

@@ -4295,9 +4295,9 @@ minimist-options@^4.0.2:
kind-of "^6.0.3"
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
mixin-deep@^1.2.0:
version "1.3.2"