Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Adds null checks (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc authored and mrose17 committed Feb 28, 2018
1 parent d512f6c commit 13686d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,14 @@ Synopsis.prototype._topN = function (n, scorekeeper, allP) {

results = []
underscore.keys(this.publishers).forEach(function (publisher) {
if (!this.publishers[publisher].scores[scorekeeper]) return
if (
!this.publishers[publisher].scores ||
!this.publishers[publisher].scores[scorekeeper]) return

if (!this.publishers[publisher].options.stickyP) {
if (!this.publishers[publisher].options || !this.publishers[publisher].options.stickyP) {
if ((!allP) &&
((this.options.minPublisherDuration > this.publishers[publisher].duration) ||
(this.options.minPublisherVisits > this.publishers[publisher].vists))) return
(this.options.minPublisherVisits > this.publishers[publisher].visits))) return
}

results.push(underscore.extend({ publisher: publisher }, underscore.omit(this.publishers[publisher], 'window')))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bat-publisher",
"version": "2.0.12",
"version": "2.0.13",
"description": "Routines to identify publishers for the BAT.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 13686d8

Please sign in to comment.