Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

ragnar-data

Get, format, filter, and sort the data for each Ragnar race.

NPM Build Status js-standard-style Greenkeeper badge

Requires Node >=6

Install

npm install ragnar-data --save
# or for the CLI
npm install ragnar-data --global

Usage

JS

const ragnarData = require('ragnar-data')

ragnarData({
  // Filter the list of races (uses _.filter)
  filter: { type: 'trail' },
  // Pick which keys that will be in each result
  pick: ['name', 'elevation_gain', 'distance'],
  // Omit can also be used to blacklist certain keys
  omit: ['legs']
  // Sort the results (uses _.orderBy)
  sort: ['elevation_gain', 'desc'],
  // Will cache data to this directory and use it for subsequent runs
  // Defaults to prefixed path using env-paths.config
  cache: path.resolve(__dirname, '.your-ragnar-data')
  // Request the data from the API even if cache is available
  refresh: true
})
// Returns a promist
.then((races) => console.log(races))
.catch((err) => console.error(err))

CLI

ragnar-data \
   # A shortcut for filtering based on type
  --type trail \
  # You can always use a properly encoded json object to filter
  --filter '{"type": "trail"}' \
  # Same as above
  --pick name,elevation_gain,distance \
  --omit legs \
  --sort distance,desc \
  --cache .ragnar-data \
  --refresh \
  # How to output the CLI result [table, json, markdown]
  --output table

# See all the options
ragnar-data --help

LICENSE

MIT

About

Get Ragnar race data.

Resources

License

Packages

No packages published
You can’t perform that action at this time.