Javascript utilities for working with rock climbing grades.
Sport & Traditional climbing
- Yosemite Decimal System
- French
- UIAA
- Ewbanks
- Saxon
- Brazilian
Bouldering
- Vermin (V-scale)
- Fontainebleau
Aid
- A# & C#
- Aid with mandatory free climbing (5.8 A0, etc)
Ice
- Winter Ice (WI#)
- Alpine Ice (AI#)
Code contributions are most welcome!
Join us on Discord.
Using NPM
npm install @openbeta/sandbag
Using Yarn
yarn add @openbeta/sandbag
- Convert Grades to Scores
import{French,YosemiteDecimal}from'@openbeta/sandbag'constscore=French.getScore('8a')// Output [ 84, 85 ]// Support slash gradeconstslashGradeScore=French.getScore('7c+/8a')// Output [ 83, 84 ]// Accept +/- modifierconstplusGrade=YosemiteDecimal.getScore('5.12+')// Output [ 79, 80 ]- Convert Scores to Grades
import{Font}from'@openbeta/sandbag'// Single score providedFont.getGrade(80)// Output '7c'// Support a range of scores Font.getGrade([79,81])// Output'7b+/7c'- Validate Grading Scales
import{VScale,Font}from'@openbeta/sandbag'console.log('Is 6A a V Scale?',VScale.isType('6A'))// Output falseconsole.log('Is 6A a Font Scale?',Font.isType('6A'))// Output true- Convert Grades Across Scales
import{convertGrade,GradeScales}from'@openbeta/sandbag'constydsInFrench=convertGrade('5.11a',GradeScales.YDS,GradeScales.FRENCH)// Output '6b+/6c'constfontInVScale=convertGrade('6a',GradeScales.FONT,GradeScales.VSCALE)//OutPut 'V3'// Conversions across different disciplines are not allowedconstsportToBoulder=convertGrade('5.11a',GradeScales.YDS,GradeScales.VSCALE)// Output: Scale: Yosemite Decimal System doesn't support converting to Scale: V Scale// ''- Get Gradeband
import{Ewbank}from'@openbeta/sandbag'Ewbank.getGradeBand('10')// Output: 'beginner'Ewbank.getGradeBand('30')// Output: 'expert'Ewbank.getGradeBand('6a')// Output: Unexpected grade format: 6a for grade scale Ewbank 'unknown'- Compare Grades
import{French,YosemiteDecimal}from'@openbeta/sandbag'constharder=French.getScore('8a')// Output: [ 84, 85 ]consteasier=YosemiteDecimal.getScore('5.13a')// Output: [ 82, 83 ]console.log('Is 8a harder than 5.13a?',harder>easier)// Output: trueSee unit tests for more examples.
yarn install
yarn test
To generate a test coverage report using Jest run the following command in your terminal:
npx jest --coverageIf you're using macOS, you can directly access the coverage report in your browser by opening the following URL:
file:///Users/<userName>/sandbag/coverage/lcov-report/index.html
Submit a PR with commit message [npm publish]
MIT
Thanks goes to these wonderful people (emoji key):
AntoineM 💻🤔 | Kendra Gibbons 💻🤔 | MichaelDimmitt 💻 | Clinton Lunn 💻 | Darren Lew 💻🤔 | Klaus 💻🤔 | Nathan Musoke 💻🤔 |
Talia Aleyna Hortac 💻 | Yun Ji 💻🤔 | Josh Zimmerman 💻 | John Roberts 💻🤔 | Joey Marino 💻🤔 | Iacami Gevaerd 💻🤔 |
This project follows the all-contributors specification. Contributions of any kind welcome!