pathname-match
Strip a url to only match the `pathname`.
Last updated 8 years ago by yoshuawuyts .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install pathname-match 
SYNC missed versions from official npm registry.

pathname-match

NPM version build status Test coverage Downloads

Strip a url to only match the pathname. Weighs only 200 bytes gzipped.

Installation

$ npm install pathname-match

Usage

const pathMatch = require('pathname-match')
const wayfarer  = require('wayfarer')

const router = wayfarer('/')

router.on('/', => console.log('home'))
router.on('/derp', => console.log('derp'))
router.on('/404', => console.log('not found'))

router.match(pathMatch('/derp/#foo?bin=baz'))
// => '/derp'

Why?

It's meant to feed the output to a router such as wayfarer, and not having to worry about hashes in the url. This used to be part of wayfarer, but has been stripped out to make the api even smaller.

See Also

License

MIT

Current Tags

  • 1.2.0                                ...           latest (8 years ago)

6 Versions

  • 1.2.0                                ...           8 years ago
  • 1.1.3                                ...           9 years ago
  • 1.1.2                                ...           9 years ago
  • 1.1.1                                ...           9 years ago
  • 1.1.0                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |