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

time-pace-speed

v0.1.1

Published

Simple library for competitions result calculation - time, pace, speed, etc.

Downloads

10

Readme

time-pace-speed

Simple library for competitions result calculation - time, pace, speed, etc. Also is good for time formatting, add times, substract times, etc.

Welcome

Package is in development state. Feel free to open pull request and/or propouse new features, bug-fixing, etc. It's under MIT license.

Installation

$ npm install time-pace-speed

How to use?

import tps from 'time-pace-speed';

DISTANCE

// Init
tps.dist(1, 'km'); // [tpsDist Object] dist = 1km
tps.dist(1000);    // [tpsDist Object] dist = 1000m

// Convert
var d = tps.dist(1000);
d.km();    // -> 1
d.m();     // -> 1000
d.miles(); // -> 0.621371192237334

// Add / Substract
tps.dist(1, 'km').add(1).km();      // -> 1.001 (1km + 1m = 1.001km)
tps.dist(1, 'km').substract(1).m(); // -> 999   (1km - 1m = 999m)

DURATION (TIME)

// Init
tps.time('01:13:45.120');   // [tpsTime Object]
tps.time('13:45', 'mm:ss'); // [tpsTime Object]

// As Moment
tps.time('01:13:45.120').asMoment(); // [Moment Object]

// Format
tps.time('01:13:45.120').format();             // -> 01:13:45.120
tps.time('00:13:45.000').format('mm:ss');      // -> 13:45
tps.time('13:45', 'mm:ss').format('HH:mm:ss'); // -> 00:13:45

// Convert 
var t = tps.time('01:13:45.120');
t.milliseconds(); // -> 4425120
t.seconds();      // -> 4425.12
t.minutes();      // -> 73.752
t.hours();        // -> 1.2291999999999998

// Add / Subsract
tps.time('01:13:45.120').add('01:00:00.000').add('01.00.00.999').format(); // -> 03:13:46.119
tps.time('01:13:45.120').substract('01:00:00.100').format();               // -> 00:13:45:020

INTERVAL

// Init
tps.interval(21600, '01:13:45.120');        // [tpsInterval Object]
tps.interval(21.6, '01:13', 'km', 'HH:mm'); // [tpsInterval Object]

// Calculate Speed
var i = tps.interval(21600, '01:13:45.120');
i.speed.km_h(); // -> 17.572404816140583
i.speed.mph();  // -> 10.91898613108234

// Calculate Pace
var i = tps.interval(21600, '01:13:45.120');
i.pace.per_km().format();            // -> 00:03:24.866
i.pace.per_km().format('mm:ss.SSS'); // -> 03:24.866

[TODO]

Add description for all classes