gw2e-account-statistics 3.10.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,8 @@ exports.default = function (accountData) {
7
7
  return {
8
8
  characterCount: null,
9
9
  maxLevelCharacterCount: null,
10
- deathCount: null
10
+ deathCount: null,
11
+ mostPlayedCharacterPlaytime: null
11
12
  };
12
13
  }
13
14
 
@@ -22,10 +23,16 @@ exports.default = function (accountData) {
22
23
  }).reduce(function (a, b) {
23
24
  return a + b;
24
25
  }, 0);
26
+ var mostPlayedCharacterPlaytime = accountData.characters.map(function (character) {
27
+ return character.age;
28
+ }).reduce(function (a, b) {
29
+ return Math.max(a, b);
30
+ }, 0);
25
31
 
26
32
  return {
27
33
  characterCount: characterCount,
28
34
  maxLevelCharacterCount: maxLevelCharacterCount,
29
- deathCount: deathCount
35
+ deathCount: deathCount,
36
+ mostPlayedCharacterPlaytime: mostPlayedCharacterPlaytime
30
37
  };
31
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gw2e-account-statistics",
3
- "version": "3.10.0",
3
+ "version": "3.11.0",
4
4
  "description": "Calculate statistics of guildwars2 accounts",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
@@ -7,7 +7,8 @@ describe('statistics > characters', () => {
7
7
  expect(charactersStatistics({})).to.deep.equal({
8
8
  characterCount: null,
9
9
  maxLevelCharacterCount: null,
10
- deathCount: null
10
+ deathCount: null,
11
+ mostPlayedCharacterPlaytime: null
11
12
  })
12
13
  })
13
14
 
@@ -39,7 +40,8 @@ describe('statistics > characters', () => {
39
40
  expect(charactersStatistics({characters: data})).to.deep.equal({
40
41
  characterCount: 3,
41
42
  deathCount: 3942,
42
- maxLevelCharacterCount: 2
43
+ maxLevelCharacterCount: 2,
44
+ mostPlayedCharacterPlaytime: 8590624
43
45
  })
44
46
  })
45
47
 
@@ -47,7 +49,8 @@ describe('statistics > characters', () => {
47
49
  expect(charactersStatistics({characters: []})).to.deep.equal({
48
50
  characterCount: 0,
49
51
  deathCount: 0,
50
- maxLevelCharacterCount: 0
52
+ maxLevelCharacterCount: 0,
53
+ mostPlayedCharacterPlaytime: 0
51
54
  })
52
55
  })
53
56
  })