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

running-hills-factor

v1.1.0

Published

Calculate how much running time is expected to be gained or lost based on course elevation map

Readme

Running Hills Factor

Node.js CI

How much should a runner factor in the hills for a particular route to alter an expected finish time? Running Hills Factor calculates how much time could be expected to be gained or lost while running due to hills.

Methodology

For every percent grade value in a running route, there is a corresponding difference in expected pace per percent grade. For instance, if the route has a 3% incline, then it can be expected that a runner's pace would slow down ~15 seconds per mile per percent grade (45 seconds per mile slower). Similarly, if there is a 2% decline in the route, then it can be expected that a runner's pace would speed up ~8 seconds per mile per percent grade (16 seconds per mile faster).

  • Uphill: every % grade incline slows down pace 15 seconds per mile by default (pacing done in minutes per mile)
  • Downhill: every % grade decline increases pace 8 seconds per mile by default (pacing done in minutes per mile)

Running Hills Factor uses the percent grade to calculate the time gained or lost from each segment of the route provided and sums over the whole distance of the route.

Getting Started

To install Running Hills Factor, use the command:

npm install running-hills-factor

Example usage using ES modules:

import RunningHillsFactor from 'running-hills-factor';

const runningHillsFactor = new RunningHillsFactor();

runningHillsFactor.calculateHillsFactor('./example.gpx')
  .then(timeDifference => console.log('Total gained or lost time:', timeDifference))
  .catch(err => console.error('Error calculating hills factor:', err));

If you're using CommonJS modules, then you can bring in the class with:

const RunningHillsFactor = require('running-hills-factor');

const runningHillsFactor = new RunningHillsFactor();

Note: Currently, this package runs with NodeJS versions 14 or greater.

API Documentation

Running Hills Factor is designed with a class to be able to create multiple instances of the calculator with different configuration options.

For example, one instance can be configured for a runner where for every % grade incline, they slow down 12 seconds per mile. Where another instance can represent another runner where for every % grade incline, they slow down 20 seconds per mile.

class: RunningHillsFactor(options)

  • options <Object>
    • inclineFactor <Number> the number of seconds per mile each % grade incline slows down. This number should be positive. Defaults to 15 (seconds).
    • declineFactor <Number> the number of seconds per mile each % grade decline speeds up. This number should be positive. Defaults to 8 (seconds).

Example options usage:

const runningHillsFactor = new RunningHillsFactor({inclineFactor: 13, declineFactor: 7});

RunningHillsFactor.calculateHillsFactor(filepath)

  • filepath<String> Filepath to the running course route. Current support is for the GPX file format from https://onthegomap.com/.
  • returns: <Promise> where the resolved value is the total time gained or lost in seconds, and the rejected value is an error. Time is gained if the resolved value is positive. Time is lost if the resolved value is negative.