New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

scores

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scores - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

35

lib/score-tracker.js

@@ -11,3 +11,3 @@ var EventEmitter = require('events').EventEmitter,

var scoresUrl = "http://scores.espn.go.com/ncb/scoreboard?date={date}&confId=50";
var scoresUrl = "http://scores.espn.go.com/ncb/scoreboard?date={date}&confId=100";
var interval = (15*60*1000); // default: 15 minutes

@@ -29,5 +29,7 @@ var watching = false;

cleanUp();
request(scoresUrl, function (error, response, body) {
if (!error && response.statusCode == 200) {
jsdom.env(
var x = jsdom.env(
body,

@@ -38,2 +40,3 @@ ["http://code.jquery.com/jquery.js"],

processScores(window.$, games);
x = null;
}

@@ -45,4 +48,20 @@ );

function cleanUp() {
var clean = {};
_.each(games, function(item, idx) {
if(item.status !== 'final') {
clean[idx] = item;
}
});
games = clean;
clean = null;
}
function processScores($, $els) {
var gameChanges = [],
gameFinals = [];
$els.each(function(idx, item) {

@@ -55,2 +74,3 @@ var matchups = $(item).find('div.span-2');

var status = $(gameDiv).find('.game-status p').text();
var game = {

@@ -61,4 +81,6 @@ id: null,

winner: false,
region: $(gameDiv).find('.game-note').text().match(/ ([A-Za-z]*) REGION /)[1],
home: {
team: $(gameDiv).find('.home .team-name span a').attr('title'),
seed: parseInt($(gameDiv).find('.home .team-name span:first-child').text(), 10),
score: null

@@ -68,2 +90,3 @@ },

team: $(gameDiv).find('.visitor .team-name span a').attr('title'),
seed: parseInt($(gameDiv).find('.visitor .team-name span:first-child').text(), 10),
score: null

@@ -100,3 +123,6 @@ }

!_.isEqual(games[gameId], game)) {
ST.emit('gameChange', game);
gameChanges.push(game);
if(game.status === 'final') {
gameFinals.push(game);
}
}

@@ -107,2 +133,5 @@

});
if (gameChanges.length > 0) ST.emit('gameChange', gameChanges);
if (gameFinals.length > 0) ST.emit('gameFinal', gameFinals);
}

@@ -109,0 +138,0 @@

2

package.json
{
"name": "scores",
"version": "0.1.2",
"version": "0.1.3",
"description": "Node module for score tracking for NCAA basketball.",

@@ -5,0 +5,0 @@ "main": "index.js",

var ScoreTracker = require('./index').ScoreTracker;
var st = new ScoreTracker();
var st = new ScoreTracker({interval: 60000});

@@ -10,4 +10,11 @@ st.on('gameChange', function(game) {

st.on('gameFinal', function(game) {
console.log('Game Final:');
console.log(game);
});
debugger;
st.watch();
console.log('Watching ESPN Game Feed');
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