🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

tods-matchup-format-code

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tods-matchup-format-code

parse and stringify methods for working with TODS matchUp Format Codes

1.1.8
latest
Source
npm
Version published
Weekly downloads
69
-80.45%
Maintainers
1
Weekly downloads
 
Created
Source

TODS MatchUp Format Code

The Tennis Open Data Standards MatchUp Format Codes provide a concise way of describing methods for scoring tennis matches that is both human and machine readble.

SET3-S:6/TB7 is the TODS representation for "Best 2 Out Of 3 Sets (Win By Two) 6 games with Tiebreak to 7

This package includes two methods to make it easier to work with TODS MatchUp Format Codes in projects related to tennis, by transforming valid format codes into JSON and valid JSON objects back into format codes.

Online Documentation with examples

Installation

npm install tods-matchup-format-code

Use

import { matchUpFormatCode } from 'tods-matchup-format-code';

let parsedCode = matchUpFormatCode.parse('SET3-S:6/TB7');

Methods

parse

Converts a TODS MatchUp Format Code into JSON

matchUpFormatCode.parse('SET3-S:6/TB7')

// results in...

{
  bestOf: 3,
  setFormat: { setTo: 6, tiebreakFormat: { tiebreakTo: 7 }, tiebreakAt: 6 }
}

Parsing 'SET3-S:6/TB7-F:TB10' results in:

{
  bestOf: 3;
  finalSetFormat: {
    tiebreakSet: {
      tiebreakTo: 10;
    }
  }
  setFormat: {
    setTo: 6;
    tiebreakAt: 6;
    tiebreakFormat: {
      tiebreakTo: 7;
    }
  }
}

stringify

Converts compliant JSON into a TODS MatchUp Format Code, the reverse of the .parse() method.

machUpFormatCode.stringify(matchUpFormatObject);

isValidMatchUpFormat

Returns boolean indicating whether matchUpFormat is valid.

matchUpFormatCode.isValidMatchUpFormat('SET3-S:6/TB7');

Keywords

TODS

FAQs

Package last updated on 10 May 2022

Did you know?

Socket

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.

Install

Related posts