0.1.0 • Published 7 years ago
path-extract v0.1.0
path-extract
Install
yarn add path-extract
Usage
const extract = require('path-extract')
extract('/user/:username/post/:id', '/user/egoist/post/1')
//=> params:
{
username: 'egoist',
id: '1'
}
extract('/user/*', '/user/egoist/post/1')
//=> params:
{
'*': 'egoist/post/1'
}
extract('/user/:id', '/list/foo')
//=> null
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
path-extract © egoist, Released under the MIT License. Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin
0.1.0
7 years ago