https://github.com/uppercod/r-match
📙 It will take route parameters in a simple and predictable way
https://github.com/uppercod/r-match
Last synced: about 1 year ago
JSON representation
📙 It will take route parameters in a simple and predictable way
- Host: GitHub
- URL: https://github.com/uppercod/r-match
- Owner: UpperCod
- License: apache-2.0
- Created: 2018-04-04T15:34:09.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-04T15:38:01.000Z (about 8 years ago)
- Last Synced: 2025-01-24T08:47:54.326Z (over 1 year ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# r-path
This class creates an object that teaches with 2 important properties:
* path : this property shows the path of the route, divided into an array
* query : this property shows the query of the route, divided into an object
## Match-path::match
The match method of the **Match-route** instance allows you to execute the source route as a route template,
based on the following parameters:
* `{param}` : **param** will be the name of the **mandatory parameter** stored in the match return
* `{param?}` : **param** will be the name of the **optional parameter** stored in the match return
* `{...param}` : **param** will be the name of the **group parameter** stored in the match return
si la comparación no cumple con el template de ruta este retorna falso
### Match-path::match, Example
```javascript
import Route from "r-path";
let route = new Route('/path1/{subpath}')
console.log(route.match('/path1/path2')) // {subpath : 'path2'}
```