Comparing version 3.2.0 to 3.3.0
@@ -55,5 +55,11 @@ 'use strict' | ||
const parseSeries = (s) => { | ||
if (!s) return {} | ||
const playedCompetitions = _.sumBy(s.summary.match(/\d+/g), (n) => +n) | ||
return Object.assign(_.pick(s, 'totalCompetitions', 'completed'), { playedCompetitions }) | ||
const playedCompetitions = _.sumBy(_.get(s, 'summary', '1-0').match(/\d+/g), (n) => +n) | ||
const totalCompetitions = _.get(s, 'totalCompetitions', playedCompetitions) | ||
const completed = _.get(s, 'completed', playedCompetitions === totalCompetitions) | ||
return { | ||
completed, | ||
totalCompetitions, | ||
playedCompetitions | ||
} | ||
} | ||
@@ -60,0 +66,0 @@ |
{ | ||
"name": "scores", | ||
"description": "Track the completion of sports games from a URL.", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"author": "Luke Karrys <luke@lukekarrys.com>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -24,3 +24,3 @@ 'use strict' | ||
t.deepEqual(events[0].series, {}) | ||
t.deepEqual(events[0].series, { completed: true, playedCompetitions: 1, totalCompetitions: 1 }) | ||
t.equal(events[0].seriesCompleted, true) | ||
@@ -27,0 +27,0 @@ |
@@ -24,3 +24,3 @@ 'use strict' | ||
t.deepEqual(events[0].series, {}) | ||
t.deepEqual(events[0].series, { completed: true, playedCompetitions: 1, totalCompetitions: 1 }) | ||
t.equal(events[0].seriesCompleted, true) | ||
@@ -62,3 +62,3 @@ | ||
t.deepEqual(events[1].series, {}) | ||
t.deepEqual(events[1].series, { completed: true, playedCompetitions: 1, totalCompetitions: 1 }) | ||
t.equal(events[1].seriesCompleted, true) | ||
@@ -65,0 +65,0 @@ |
@@ -23,3 +23,3 @@ 'use strict' | ||
t.deepEqual(events[0].series, {}) | ||
t.deepEqual(events[0].series, { completed: true, playedCompetitions: 1, totalCompetitions: 1 }) | ||
t.equal(events[0].seriesCompleted, true) | ||
@@ -26,0 +26,0 @@ |
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
4961308
848