Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
soccer-predictor
Advanced tools
A JS library that predicts soccer match outcomes using basic mathematics
A JS library that predicts soccer match outcomes using basic mathematics.
yarn add soccer-predictor # yarn
npm install soccer-predictor --save # npm
git clone https://github.com/CookPete/soccer-predictor.git
cd soccer-predictor
yarn # or npm install
npm run build
npm test # Run tests
import { analyseResults, calculateProbabilities } from 'soccer-predictor'
// Some basic example data
const results = [
{ homeTeam: 'Team A', awayTeam: 'Team B', homeGoals: 1, awayGoals: 0 },
{ homeTeam: 'Team B', awayTeam: 'Team C', homeGoals: 2, awayGoals: 1 },
{ homeTeam: 'Team C', awayTeam: 'Team A', homeGoals: 1, awayGoals: 3 }
]
// Function to map match data to soccer-predictor data
function getMatchDetails (match) {
return {
homeTeamName: match.homeTeam,
awayTeamName: match.awayTeam,
homeGoals: match.homeGoals,
awayGoals: match.awayGoals
}
}
// Parse results into an array of teams with calculated stats
const teams = analyseResults(results, getMatchDetails)
// Use calculateProbabilities to calculate the chance of
// various outcomes of a match between two teams
const probabilities = calculateProbabilities(teams[0], teams[1])
console.log(probabilities.result) // Probability of a home win, away win or draw
// {
// home: 0.657541673613264,
// draw: 0.252533180170396,
// away: 0.089924594462736
// }
console.log(probabilities.scores[1][0]) // Probability of a 1-0 result
// 0.2300324502673927
console.log(probabilities.over['2.5']) // Probability of over 2.5 goals
// 0.2895346409101279
console.log(probabilities.btts.yes) // Probability of both teams to score
// 0.2429353553660894
For more examples, see examples
.
There are plenty of articles available that go into depth about basic poisson prediction. Essentially the library parses a series of match results and provides functions to return a rough percentage likelyhood of various outcomes of a match between two teams.
Further reading:
Yes, but football-predictor
seems too ambigious. Everyone knows what soccer is.
FAQs
A JS library that predicts soccer match outcomes using basic mathematics
The npm package soccer-predictor receives a total of 3 weekly downloads. As such, soccer-predictor popularity was classified as not popular.
We found that soccer-predictor 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.