Git Product home page Git Product logo

gradr_lib's Introduction

Convert climbing grading systems with a really simple interface.

Pub Version


WORK IN PROGRESS, use at your own risk.

Have you ever needed to convert from one grading system to another? and had to implement the calculations by yourself? gradr_lib offers utilities for converting climbing grading systems with a really simple interface so you don't have to reinvent the wheel.

The library was initial going to be developed for the Gradr App I've also created, but thought it might be cool to make it open-source and let the community use it and hopefully help improve it too!

Gradr does all it can to make sense of the differences and inconsistencies between grading systems, so take note that converting from one grading system to another might not always be acurate. You can take a look at this writup on how gradr handles this. Feel free to offer any advice or help in this regard!

Features

  • Grading systems
    • V-Scale
    • Font
    • French
    • YDS
    • South africa
    • Brazil
    • UK
    • IRCRA
    • UIAA
    • ...
  • Conversion between grading systems
  • Grading system detector

Getting started

To install the package check the install guide

Usage

Convert between Grading Systems

Here is an example on how to convert from V-Scale to Font scale and viceversa, using GradeCalculator:

final vToFont = GradeCalculator(
    systemA: verminGradeSystem,
    systemB: fontGradeSystem,
);

// Convert from grading system A (vScale) to system B (fontScale)
vToFont.atob(
    vScale.findByName('V3')
);

// > 6B

// Convert from grading system B (fontScale) to system A (vScale)
vToFont.btoa(
    fontScale.findByName('6B')
);
// > V3

You can also convert using the from-to interface, as follows:

fontGradeSystem.convert('v3').from(verminGradeSystem); // 6b
fontGradeSystem.convert('6b').to(verminGradeSystem);   // v3

Detect Grading System

Gradr also offers a utility to detect grading systems.

final detector = GradeSystemDetector(
    detectors: [
      VScaleGradeDetector(),
      FontGradeDetector(),
      FontGradeDetector(),
    ],
);

GradeDetectorResult detectedResult = detector.detect(grade);

// A list of posible grading systems is returnes in the result
detectedResult.detectedSystems;

// It also returns a list of "formalized" grades (instance of Gradr Grade class).
detectedResult.formalizedGrades;

// It also returns the original input
detectedResult.originalInput;
  • Note that the GradeSystemDetector allows you to pass in the detectors you need, and/or custom detectors.

Need Gradr for another platform?

You might be in luck, at gradr we're trying to offer the libraries for most common languages and frameworks. Take a look and see if the one you need is already done.

  • Dart
  • JavaScript
    • React
    • Angular
    • Ionic
    • Vue
  • Java
  • PHP

If your platform or language is missing, feel free to file an issue and we will try to implement it. Or if you feel like it and have the time, you can contact us to help build it, we love that kind of stuff! โค๏ธ

Additional info

There are some examples here and here.

If you encounter any problems or fancy a feature to be added please head over to the GitHub repository and drop an issue.

Support the project

I tend to open source anything I can, and love to help people that might need help with the project.

If you are using this project and are happy with it or just want to encourage me to continue creating stuff, there are few ways you can do so:

  • Starring and sharing the project ๐Ÿš€
  • Reporting bugs ๐Ÿ›
  • Sending feedback
  • Or even coding :P

Thanks! โค๏ธ

gradr_lib's People

Contributors

nombrekeff avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.