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 🙏

© 2024 – Pkg Stats / Ryan Hefner

run-pace

v2.1.0

Published

Calculate running pace

Downloads

12

Readme

run-pace

Calculate running pace, time or length by providing the other two.

Interactive demo: https://daghall.github.io/run-pace/

Table of contents

CLI

Run as a command line program.

Installation

npm install -g run-pace

Usage

run-pace -t <time> -l <length> -p <pace> [-i] [-m]

Two of "time", "length" and "pace" must be provided.
"Speed" is only valid when (only) pace is given or calculated

Parameters:
   -l, --length,    <value><unit> (10km, 10mi, 10000m, hm, ma)
   -p, --pace,      <value>/<unit> (4:30/km, 4m30s/mi)
   -t, --time,      <value> (11:23, 11min23sec, 11m23s)
   -i, --imperial,  force imperial output
   -m, --metric,    force metric output
   -s, --speed,     output speed instead of pace

Examples

run-pace -p 4:50/km -t 1hour
12.41 km

run-pace -p 4:50/km -l 3.5km
16:55

run-pace -p 4:30/km -s -i
8.3 mph

run-pace -l 3 -t 15:00
5:00/km

Node module

Use in a node script.

Installation

npm install run-pace

Usage

const runPace = require("run-pace");

Methods

All methods takes an object as its only argument.

calculateLength

Call with an object with the properties time and length.

Example
const length = runPace.calculateLength({
  time: "45m",
  pace: "4:30/km",
});

console.log(length); // 10km

calculateTime

Call with an object with the properties pace and length.

Example
const time = runPace.calculateTime({
  length: "10km",
  pace: "4:30/km",
});

console.log(time); // 45:00

calculatePace

Call with an object with the properties time and length.

Example
const pace = runPace.calculatePace({
  time: "45m",
  length: "10km",
});

console.log(pace); // 4:30/km

Parameters in detail

Time

Can be provided in the following formats:

[[dd:][hh:]mm:ss

Examples
  • 04:40
  • 2:44:36
  • 0:59
  • 0:3599 (non-standard)

X<d>Y<h>Z<m>W<s>

Only one unit needs to be provided.

  • <d>is in the format days, day or d
  • <h>is in the format hours, hour, hrs or h
  • <m>is in the format mins, min or m
  • <s>is in the format secs, sec or s
Examples
  • 2days13hours45mins16secs
  • 3hrs15sec
  • 23m16s

Length

Defaults to kilometers. If length is provided in miles, imperial output is implicitly enabled, but can be overridden using the metric switch.

If no unit is given, the type is inferred from the metric/imperial flags, and/or the unit given in the pace field.

X<unit>

X is a number, including optional decimal point

<unit> is one of the following:

  • Kilometers: km or k
  • Meters: m
  • Miles: mi
  • Blank: defaults to kilometers

<constant>

  • Half-marathon: hm
  • Marathon: ma
Examples
  • hm
  • 10k
  • 5.25KM(case-insensitive)
  • 26.21875mi

Pace

Defaults to kilometer pace. If length is provided in miles, imperial output is implicitly enabled, but can be overridden using the metric switch.

<time>/<unit>

<time> as specified above

<unit> is km or mi if explicitly given. Left blank it defaults to km or is inferred from other given parameters


Imperial

Default output is kilometers. Use this switch to force output in miles.


Metric

If miles are given in pace or length output will be in miles as well. Use this switch to force output in kilometers.


Speed

Output speed in instead of pace. Units used are km/h or mph depending on types/options specified.

Only valid if pace is given or calculated.

Tips and tricks

Convert kilometer-pace to mile-pace

run-pace -t 7m15s -l 1mi -m
4:30/km

Convert mile-pace to kilometer-pace

run-pace -t 4:30 -l 1k -i
7:15/mi

Convert kilometer-pace to km/h

run-pace -p 4:55/km -s
12.2 km/h

Convert mile-pace to mph

run-pace -p 4:00/mi -s
15 mph