pathetic
Get values by path-like keys
Last updated 10 years ago by scottcorgan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install pathetic 
SYNC missed versions from official npm registry.

pathetic

Get values by path-like keys

Install

npm install pathetic --save

Usage

var pathetic = require('pathetic');
var routes = pathetic({
  '/path': {key: 'value'},
  '/user/:id': function (req, res) {
    res.end('GOT IT!')
  }
});

var p = routes('/path'); // OUTPUTS: {key: 'value'}
var userPath = routes('/user/123');

userPath(req, res);
console.log(userPath.params().id == 123);

API

pathetic(paths)

  • paths - a key/value object containing the paths as the keys and anything for the values. This returns a method that lets you query against the table with a path. This uses Express-like paths and breaks out the parameters for your as well.

Run Tests

npm install
npm test

Current Tags

  • 1.0.0                                ...           latest (10 years ago)

5 Versions

  • 1.0.0                                ...           10 years ago
  • 0.3.1                                ...           13 years ago
  • 0.3.0                                ...           13 years ago
  • 0.2.0                                ...           13 years ago
  • 0.1.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 15
Today 1
This Week 5
This Month 15
Last Day 2
Last Week 10
Last Month 0
Dependencies (4)
Dev Dependencies (2)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE