
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
scoreboard is a light weight leaderboard for node.js. It can be used keep score and ranks between multiple objects and scoring types. It is backed by Redis and sorted sets.
$ npm install scoreboard
var scoreboard = require('scoreboard')
var Score = scoreboard.Score;
var scores = new Score();
scoreboard.redis.createClient = function() {
var client = redis.createClient(1234, '192.168.100.1');
client.auth('somethingsecret');
return client;
};
Awarding point to an object is simple. Scoreboard supports multiple leaderboards, and is are partitioned by different a key
scores.index('monsters', 100, 'edward');
scores.index('aliens', 100, 'edward');
scores.index('monsters', 50, 'nancy');
scores.index('aliens', 200, 'nancy');
To perform a query against the scoreboard to find the leaders, you simple use Score#leader with a list of keys, and invoke run with a callback to fetch the results
Find leader in just monsters
scores.leaders({keys:['monsters']}).run(function(err, leaderboard)) {
console.log(leaderboard);
});
Results
['edward', 'nancy']
Find leader in both monsters and aliens. The scores across the two sets are totalled together
scores.leaders({keys:['monsters','aliens']}).run(function(err, leaderboard)) {
console.log(leaderboard);
});
Results:
['nancy', 'edward']
Score are stored in Redis on two types of buckets, overall and days. Obviously the overall buckets are used to track scores thoughout the entire life of the scoreboard. But day buckets allow for more percise queries.
This will return the leaderboard for monsters and aliens between 1/1/2012 and 1/31/2012:
scores.leaders({ keys:['monsters','aliens'], date: {$start: new Date('1/1/2012'), $end: new Date('1/31/2012') } })
.run(function(err, leaderboard)) {
console.log(leaderboard);
});
Results:
['nancy', 'edward']
Paginations is super easy with scoreboard. All you need is skip and limit
This will return the top 0 - 100 of the time series leaderboard
scores.leaders({ keys:['monsters','aliens'], date: {$start: new Date('1/1/2012'), $end: new Date('1/31/2012') } })
.skip(0)
.limit(100)
.run(function(err, leaderboard)) {
console.log(leaderboard);
});
(The MIT License)
Copyright (c) 2012 Edward Chan <edward@knowsee.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Redis leaderboard for node.js
We found that scoreboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.