lydiard
v0.1.0
Published
A JavaScript utility library to work with splits
Downloads
8
Maintainers
Readme
lydiard
Lydiard is a JavaScript library to help you work with time, distance, and combinations of time and distance, called splits. "400 meters in 59 seconds" would be a split. As would "26:22 for ten kilometers."
Lydiard is composed of a handful of data model classes, including Distance
, Split
, and Race
, and a few helper utilities to work with durations*, paces, and strings.
Example Usage
Working with Distance
s
Distance
is the first simple data class. There are a number of ways to create a new Distance
instance:
// Make a Distance instance with the constructor
const oneLap = new Distance(400, DISTANCE_UNIT.METER)
// Make a Distance instance with the `fromString` static method
const aMile = Distance.fromString('1 mile');
Why Lydiard?
Yes, it's named after the late, great New Zealand distance running coach, Arthur Lydiard.