npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

judomanager-affiliation-pattern-parser

v1.0.7

Published

Tool used for parsing and rendering judomanager affiliation patterns

Readme

Affiliation Pattern Parser

Tool used for parsing and rendering of affiliation patterns.

Installation

Add to project using npm :

npm install judomanager-affiliation-pattern-parser

Usage

Simple example of using parser and renderer to render an instance of pattern:

// CONFIG                          - retreived using api/AffiliationPatternPlaceholderConfiguration  endpoint
// ENVIRONMENT                     - either: graphics, portal or score_board
// IGNORE_UNSUPPORTED_PLACEHOLDERS - true or false
const parser = new AffiliationPatternParser(CONFIG, ENVIRONMENT, IGNORE_UNSUPPORTED_PLACEHOLDERS);
const renderer = new AffiliationPatternRenderer();

let smt;
try {
    smt = parser.parse(pattern);

    // model - represents object that holds all of the neccessary affiliation data. Structure dependes on configuration and environment
    // USE_INTERNATIONAL_NAMES - true of false
    let whiteJudokaHTML = renderer.renderAllInTwoLines(smt, model, "white", USE_INTERNATIONAL_NAMES);
    let blueJudokaHTML = renderer.renderAllInTwoLines(smt, model, "blue", USE_INTERNATIONAL_NAMES);

} catch (err) {

    // Use err to alert user what went wrong during parsing
}

Renderer supports multiple functions to render affiliation pattern, that each handles how to render country a bit diffrently:

// Renders whole pattern in one line. Moves country entity to the beggining of the line
renderer.renderAllInLine(smt, model, judokaColor, USE_INTERNATIONAL_NAMES);

// Renders pattern in two line. First line is always for country entity, second line is the rest of the pattern
renderer.renderAllInTwoLines(smt, model, judokaColor, USE_INTERNATIONAL_NAMES);

// Renders whole pattern in one line, but ignores country entity
renderer.renderOnlyMain(smt, model, judokaColor, USE_INTERNATIONAL_NAMES);

// Renders only country entity and ignore the rest of the pattern
renderer.renderOnlyCountry(smt, model, judokaColor, USE_INTERNATIONAL_NAMES);

Custom Renderer

In case you want to create your own renderer use getRenderTree(smt, model, judoka_color) function of AffiliationPatternRenderer to obtain render tree, that you can than use as an input of your renderer. Example:


const parser = new AffiliationPatternParser(CONFIG, ENVIRONMENT, IGNORE_UNSUPPORTED_PLACEHOLDERS);
const renderer = new AffiliationPatternRenderer();

const smt = parser.parse(pattern);

const judokaColor = "white";
const countryRenderMode = "seperate_line_first";


// Possible values for countryRenderMode are:
// ignore                (Ignores country entity when rendering)
// same_line_normal      (Renders pattern in one line, directly as it is written)
// same_line_first       (Renders pattern in one line, but moves country entity at the beggining)
// seperate_line_first   (Renders pattern in two lines. Country is always in the first line)
// only_country          (Renders only country and ignores the rest of the pattern)

let renderTree = renderer.getRenderTree(smt, model, judokaColor, countryRenderMode);

// Example of render tree for '{country_image} {country_short} {club_image} - {club} ({region_short})' 
// Use this render tree structure to easly implement your own renderer

// [
//     {
//         "type": "level",
//         "children": [
//             {
//                 "type": "image",
//                 "key": "country_image",
//                 "value": "https://cdn.judomanager.com/countries/flags/20x15/pol.png"
//             },
//             {
//                 "type": "space"
//             },
//             {
//                 "type": "string",
//                 "key": "country_short",
//                 "value": "POL"
//             }
//         ]
//     },
//     {
//         "type": "level",
//         "children": [
//             {
//                 "type": "space"
//             },
//             {
//                 "type": "image",
//                 "key": "club_image",
//                 "value": "https://cdn.judomanager.com/clubs/club_3517.jpeg"
//             },
//             {
//                 "type": "space"
//             },
//             {
//                 "type": "string",
//                 "value": "-"
//             },
//             {
//                 "type": "space"
//             },
//             {
//                 "type": "string",
//                 "key": "club",
//                 "value": "ჯორჯია რუსთავი"
//             },
//             {
//                 "type": "space"
//             },
//             {
//                 "type": "string",
//                 "value": "("
//             },
//             {
//                 "type": "string",
//                 "key": "region_short",
//                 "value": "AKHG (ახლგ)"
//             },
//             {
//                 "type": "string",
//                 "value": ")"
//             }
//         ]
//     }
// ]