Skip to content

JS utilities for working with climbing grades

License

Notifications You must be signed in to change notification settings

marinojoey/sandbag

 
 

Repository files navigation

Develop branch License

All Contributors

What is this?

Javascript utilities for working with rock climbing grades.

Supported systems

Sport & Traditional climbing

  • Yosemite Decimal System
  • French
  • UIAA
  • Ewbanks
  • Saxon

Bouldering

  • Vermin (V-scale)
  • Fontainebleau

Aid

  • A# & C#
  • Aid with mandatory free climbing (5.8 A0, etc)

Ice

  • Winter Ice (WI#)
  • Alpine Ice (AI#)

Help Wanted

Code contributions are most welcome!

Questions?

Join us on Discord.


How to use the library

Install the package

Using NPM

npm install @openbeta/sandbag

Using Yarn

yarn add @openbeta/sandbag

Sample Usage

  • Convert Grades to Scores
import { French, YosemiteDecimal } from '@openbeta/sandbag'

const score = French.getScore('8a') // Output [ 84, 85 ]

// Support slash grade
const slashGradeScore=French.getScore('7c+/8a') // Output [ 83, 84 ]

// Accept +/- modifier
const plusGrade= YosemiteDecimal.getScore('5.12+') // Output [ 79, 80 ]
  • Convert Scores to Grades
import { Font } from '@openbeta/sandbag'

// Single score provided
Font.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 false
console.log('Is 6A a Font Scale?',Font.isType('6A')) // Output true
  • Convert Grades Across Scales
import {convertGrade , GradeScales }from '@openbeta/sandbag'

const ydsInFrench=convertGrade('5.11a',GradeScales.YDS,GradeScales.FRENCH) // Output '6b+/6c'

const fontInVScale=convertGrade('6a',GradeScales.FONT,GradeScales.VSCALE) //OutPut 'V3'

// Conversions across different disciplines are not allowed
const sportToBoulder=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'

const harder = French.getScore('8a')  // Output: [ 84, 85 ]
const easier = YosemiteDecimal.getScore('5.13a') // Output: [ 82, 83 ]

console.log('Is 8a harder than 5.13a?',harder > easier) // Output: true

See unit tests for more examples.

Development (TBD)

yarn install
yarn test

How to publish a new release to NPM

Submit a PR with commit message [npm publish]

Project Maintainers

License

MIT

Contributors ✨

Thanks goes to these wonderful people (emoji key):

AntoineM
AntoineM

💻 🤔
Kendra Gibbons
Kendra Gibbons

💻 🤔
MichaelDimmitt
MichaelDimmitt

💻
Clinton Lunn
Clinton Lunn

💻
Darren Lew
Darren Lew

💻 🤔
Klaus
Klaus

💻 🤔
Nathan Musoke
Nathan Musoke

💻 🤔
Talia Aleyna Hortac
Talia Aleyna Hortac

💻
Yun Ji
Yun Ji

💻 🤔
Josh Zimmerman
Josh Zimmerman

💻
John Roberts
John Roberts

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

About

JS utilities for working with climbing grades

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.8%
  • Other 0.2%