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

just-exercise-parser

v1.0.1

Published

A TypeScript library for parsing, normalizing, and generating standardized exercise names

Readme

Exercise Name Formatter

A TypeScript library for parsing, normalizing, and generating standardized exercise names. This library helps fitness applications maintain consistent exercise naming conventions.

Installation

npm install just-exercise-parser  

or

yarn add just-exercise-parser

Features

  • Standardize exercise names with consistent formatting
  • Parse exercise names into component parts (movement, bodypart, equipment, etc.)
  • Generate variations of exercise names using customizable templates
  • Normalize names for comparison (e.g., "Bench Press Incline" == "Incline Bench Press")
  • Smart handling of pluralization, abbreviations, and common fitness terminology
  • Support for alternating exercises
  • Customizable configuration for regex replacements and exercise components

Usage

Basic Example

import { ExerciseNameFormatter } from 'just-exercise-parser';

// Create a formatter with default configuration
const formatter = new ExerciseNameFormatter();

// Standardize an exercise name (This is what you want)
const standardized = formatter.standardizeName("db bench press incline");
console.log(standardized); // "Dumbbell Incline Bench Press"

// Normalize a name for comparison
const normalized = formatter.normalizeName("incline dumbbell chest press");
console.log(normalized); // normalized for comparison - words sorted alphabetically

// Process an exercise name to get components and variations
const processed = formatter.processExerciseName("alternating db bicep curls");
console.log(processed);
// {
//   original: "alternating db bicep curls",
//   parsed: {
//     bodypart: ["bicep"],
//     movement: ["curls"],
//     equipment: ["dumbbell"],
//     modifier: ["alternating"],
//     others: []
//   },
//   variations: ["Alternating Dumbbell Bicep Curls"]
// }

Custom Configuration

You can provide your own configuration object to customize the formatter's behavior:

import { ExerciseNameFormatter, ExerciseConfig } from 'just-exercise-parser';

const customConfig: ExerciseConfig = {
  templates: {
    "standard": "${equipment} ${movement} ${bodypart} ${modifier}",
    "alternative": "${bodypart} ${movement} with ${equipment} ${modifier}"
  },
  components: {
    "bodypart": ["abs", "back", "biceps", "chest", /* ... */],
    "movement": ["curl", "press", "raise", /* ... */],
    "equipment": ["dumbbell", "barbell", "kettlebell", /* ... */],
    "modifier": ["alternating", "single arm", "single leg", /* ... */],
    "others": []
  },
  replacements: [
    { pattern: "\\bdb\\b", replacement: "dumbbell", ignoreCase: true },
    { pattern: "\\bbb\\b", replacement: "barbell", ignoreCase: true },
    // Add more replacements as needed
  ]
};

// Create a formatter with custom configuration
const formatter = new ExerciseNameFormatter(customConfig);

Generate Exercise Variations

You can generate multiple variations of an exercise name using different templates:

const processed = formatter.processExerciseName(
  "dumbbell incline chest press",
  ["standard", "alternative"]
);

console.log(processed.variations);
// [
//   "Dumbbell Incline Chest Press", 
//   "Chest Press with Dumbbell Incline"
// ]

API Reference

Classes

ExerciseNameFormatter

The main class for formatting exercise names.

Constructor

constructor(config?: ExerciseConfig)
  • config: Optional configuration object. If not provided, default configuration will be used.

Methods

  • standardizeName(exerciseName: string): string - Standardize an exercise name with consistent formatting
  • normalizeName(exerciseName: string, internalName = false): string - Normalize an exercise name for comparison
  • parseExerciseName(exerciseName: string): ExerciseComponents - Parse an exercise name into its component parts
  • generateExerciseName(components: Record<string, string[]>, templateName = 'standard'): string - Generate an exercise name from components using a template
  • processExerciseName(exerciseName: string, templateNames?: string[]): ProcessedExercise - Process an exercise name and generate variations
  • setConfig(config: ExerciseConfig): void - Update the configuration
  • cleanExerciseName(exerciseName: string): string - Clean an exercise name using regex replacements

Static Methods

  • toTitleCase(input: string, customExceptions?: string[]): string - Convert text to title case
  • getDefaultConfig(): ExerciseConfig - Get the default configuration

Interfaces

ExerciseConfig

Configuration structure for the exercise name formatter.

interface ExerciseConfig {
  templates: Record<string, string>;
  components: Record<string, string[]>;
  replacements?: RegexReplacementConfig[];
}

RegexReplacementConfig

Configuration structure for regex replacements.

interface RegexReplacementConfig {
  pattern: string;
  replacement: string;
  ignoreCase?: boolean;
}

ExerciseComponents

Represents the parsed components of an exercise name.

interface ExerciseComponents {
  originalName: string;
  components: Record<string, string[]>;
}

ProcessedExercise

Represents a processed exercise with original name, parsed components, and variations.

interface ProcessedExercise {
  original: string;
  parsed: Record<string, string[]>;
  variations: string[];
}

License

MIT