Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glaivepro/wa-calculator
https://github.com/glaivepro/wa-calculator
hacktoberfest
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/glaivepro/wa-calculator
- Owner: GlaivePro
- Created: 2023-01-28T13:50:22.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-21T22:26:04.000Z (over 1 year ago)
- Last Synced: 2024-09-25T21:07:53.191Z (4 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# WA Calculator
Point calculators for track & field events
For PHP version of this library see [GlaivePro/IaafPoints](https://github.com/GlaivePro/IaafPoints).
## Installation
No CDN support at the moment, you have to import and bundle it yourself.
```sh
npm i @glaivepro/wa-calculator
```## Usage
```js
import { WaCalculator } from '@glaivepro/wa-calculator'const options = [
edition: '2017', // edition of scoring tables, default is '2017'
gender: 'm', // 'm' or 'f', default is 'm'
venueType: 'outdoor', // 'indoor' or 'outdoor', default is 'outdoor'
electronicMeasurement: true, // whether electronic or hand time was taken, default is true
discipline: '200m', // no default, see below how to list available keys
];const calculator = new WaCalculator(options)
// Evaluate a result getting some points or a class assigned to result.
const points = calculator.evaluate(21.61) // 980// Update options
calculator.setOptions({ gender : 'f' })
const femalePoints = $calculator->evaluate(21.61) // 1279// Get list of editions
calculator.getEditions()// Get list of discipline keys available for current edition, venueType and gender
calculator.getDisciplines()
```Some options for advanced usage:
```js
// Get calculation coefficients for current setup
calculator.getCoefficients()// Calculate from result using given coefficients
const resultShift = -110
const conversionFactor = 0.335
const pointShift = 0
calculator.evaluateUsing(result, { resultShift, conversionFactor, pointShift })
```## TODO/wishlist
- [x] WA (Hungarian) points calculator
- [x] WA (Hungarian) points 2022
- [ ] Combined points calculator
- [ ] Dist for browser support
- [ ] TS support