Skip to content

Commit

Permalink
chore: update prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
redonkulus committed Dec 9, 2024
1 parent 2703e64 commit 9994e19
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 69 deletions.
68 changes: 34 additions & 34 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,119 @@

## 3.0.1

- [#114] fix handling of array like query params
- [#114] fix handling of array like query params

## 3.0.0

### Breaking Changes

- [#110] `routr` uses native `URLSearchParams` instead of `query-string` to parse query strings. As a consequence, parsing `?foo` will result in `{ foo: '' }` as specified in the [WHATWG spec](https://url.spec.whatwg.org/#interface-urlsearchparams) instead of `{ foo: null }` as `query-string` would do. Also, `URLSearchParams` is not available in older browsers (noticeably IE11). If you need to support them, you can either add a `URLSearchParams` polyfill or inject `query-string` when instantiating `routr`:
- [#110] `routr` uses native `URLSearchParams` instead of `query-string` to parse query strings. As a consequence, parsing `?foo` will result in `{ foo: '' }` as specified in the [WHATWG spec](https://url.spec.whatwg.org/#interface-urlsearchparams) instead of `{ foo: null }` as `query-string` would do. Also, `URLSearchParams` is not available in older browsers (noticeably IE11). If you need to support them, you can either add a `URLSearchParams` polyfill or inject `query-string` when instantiating `routr`:

```js
router = new Routr(routes, {
queryLib: require('query-string'),
});
```

- [#113] Updated `path-to-regexp` to its latest version
- [#113] Updated `path-to-regexp` to its latest version

## 2.1.0

- [#37] Enhance makePath for routes with path array
- [#37] Enhance makePath for routes with path array

## 2.0.2

- [#36] Bug fix: Add support for question marks in hash fragments
- [#36] Bug fix: Add support for question marks in hash fragments

## 2.0.1

- [#35] Fix decodeURIComponent of undefined bug
- [#35] Fix decodeURIComponent of undefined bug

## 2.0.0

### Breaking Changes

- [#33] `getRoute` will now `decodeURIComponent` route values, you might need to remove `decodeURIComponent` from your route actions if you were supporting extended characters manually in your routes.
- [#33] `getRoute` will now `decodeURIComponent` route values, you might need to remove `decodeURIComponent` from your route actions if you were supporting extended characters manually in your routes.

## 1.0.0

### Breaking Changes

- [#29] `navigate` is no longer used as part of `router.getRoute` options
- [#29] `route.navigate` has been removed from the matched route object
- [#29] `navigate` is no longer used as part of `router.getRoute` options
- [#29] `route.navigate` has been removed from the matched route object

### Features

- [#30] Route definitions should now be defined as an array of route objects
rather than a map of routes. The old method of defining routes
with a map is still supported, but ordering can not be guaranteed
(as per the JavaScript engine's implementation).
- [#31] Added support for parsing and constructing urls with query strings.
Matched route objects now contain a `query` property containing the map of
query parameters. `router.makePath` now accepts a third `query` parameter
which is a map of query parameters to add to the resulting URL string. e.g.
`router.makePath('home', {}, { foo: 'bar' });` will result in `/?foo=bar`.
Query strings are generated using the `query-string` npm module, but can
be customized by adding the `options.queryLib` to the `Router` constructor.
The replacement should have a `parse` and `stringify` method similar to
`query-string`. An example replacement would be `qs`.
- [#32] Allow routes to match multiple HTTP methods by using an array
for the `route.method` attribute. By default, routes with an undefined
`method` will match ANY method.
- [#30] Route definitions should now be defined as an array of route objects
rather than a map of routes. The old method of defining routes
with a map is still supported, but ordering can not be guaranteed
(as per the JavaScript engine's implementation).
- [#31] Added support for parsing and constructing urls with query strings.
Matched route objects now contain a `query` property containing the map of
query parameters. `router.makePath` now accepts a third `query` parameter
which is a map of query parameters to add to the resulting URL string. e.g.
`router.makePath('home', {}, { foo: 'bar' });` will result in `/?foo=bar`.
Query strings are generated using the `query-string` npm module, but can
be customized by adding the `options.queryLib` to the `Router` constructor.
The replacement should have a `parse` and `stringify` method similar to
`query-string`. An example replacement would be `qs`.
- [#32] Allow routes to match multiple HTTP methods by using an array
for the `route.method` attribute. By default, routes with an undefined
`method` will match ANY method.

## 0.1.3

### Features

- [#27] Support for array paths with parameter name collision
- [#27] Support for array paths with parameter name collision

## 0.1.2

### Internal

- Replace `reverand` with `path-to-regexp` for creation of paths
- Replace `reverand` with `path-to-regexp` for creation of paths

## 0.1.1

### Features

- [#22] Make route methods case-insensitive
- [#22] Make route methods case-insensitive

## 0.1.0

### Breaking Change

- Renamed "path" field to "url" in the return object of getRoute()
- Renamed "path" field to "url" in the return object of getRoute()

## 0.0.6

### Internal

- Update devDependencies and Readme
- Update devDependencies and Readme

## 0.0.5

### Features

- Freeze route objects in non-production environments
- Freeze route objects in non-production environments

## 0.0.4

### Features

- Allow matching paths containing query strings
- Allow matching paths containing query strings

## 0.0.3

### Features

- Updated dependencies
- Updated dependencies

## 0.0.2

### Features

- [#2] Introduction of `navigate` property under route
- [#2] Introduction of `navigate` property under route

## 0.0.1

Expand Down
16 changes: 8 additions & 8 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:

- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Yahoo! Inc. nor the names of YUI's contributors may be
used to endorse or promote products derived from this software without
specific prior written permission of Yahoo! Inc.
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Yahoo! Inc. nor the names of YUI's contributors may be
used to endorse or promote products derived from this software without
specific prior written permission of Yahoo! Inc.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ We use `if (process.env.NODE_ENV !== 'production')` to wrap around `Object.freez

Two main utility plugins:

- use [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin) to define the value for `process.env`
- use [UglifyJsPlugin](http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin) to remove dead code.
- use [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin) to define the value for `process.env`
- use [UglifyJsPlugin](http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin) to remove dead code.

Example of the webpack configuration:

Expand All @@ -83,8 +83,8 @@ Example of the webpack configuration:

Similar to webpack, you can also use the following two utils with your favorite build system:

- use [envify](https://github.com/hughsk/envify) to set `process.env.NODE_ENV` to the desired environment
- use [uglifyjs](https://github.com/mishoo/UglifyJS2) to remove dead code.
- use [envify](https://github.com/hughsk/envify) to set `process.env.NODE_ENV` to the desired environment
- use [uglifyjs](https://github.com/mishoo/UglifyJS2) to remove dead code.

Command-line example:

Expand All @@ -94,7 +94,7 @@ $ browserify index.js -t [ envify --NODE_ENV production ] | uglifyjs -c > bundl

## API

- [Routr](https://github.com/yahoo/routr/blob/master/docs/routr.md)
- [Routr](https://github.com/yahoo/routr/blob/master/docs/routr.md)

## License

Expand Down
30 changes: 15 additions & 15 deletions docs/routr.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@

Creates a new routr plugin instance with the following parameters:

- `routes` (optional): Ordered list of routes used for matching.
** `route.name`: Name of the route (used for path making)
** `route.path`: The matching pattern of the route. Follows rules of [path-to-regexp](https://github
.com/pillarjs/path-to-regexp)
\*\* `route.method=undefined`: The method that the path should match to. Will match all methods if `undefined` and no
methods
if `null`.
- `options` (optional): Options for parsing and generating the urls
\*\* `options.queryLib=require('query-string')`: Library to use to `parse` and `stringify` query strings
- `routes` (optional): Ordered list of routes used for matching.
** `route.name`: Name of the route (used for path making)
** `route.path`: The matching pattern of the route. Follows rules of [path-to-regexp](https://github
.com/pillarjs/path-to-regexp)
\*\* `route.method=undefined`: The method that the path should match to. Will match all methods if `undefined` and no
methods
if `null`.
- `options` (optional): Options for parsing and generating the urls
\*\* `options.queryLib=require('query-string')`: Library to use to `parse` and `stringify` query strings

## Instance Methods

### getRoute(url, options)

Returns the matched route info if path/method matches to a route; null otherwise.

- `url` (required) The url to be used for route matching. Query strings are **not** considered when performing the match.
- `options` options object
- `options.method` (optional) The case-insensitive HTTP method string. DEFAULT: 'get'
- `url` (required) The url to be used for route matching. Query strings are **not** considered when performing the match.
- `options` options object
- `options.method` (optional) The case-insensitive HTTP method string. DEFAULT: 'get'

### makePath(name, params, query)

Generates a path string with the route with the given name, using the specified params.

- `name` (required) The route name
- `params` (required) The route parameters to be used to create the path string
- `query` (optional) The query parameters to be used to create the path string
- `name` (required) The route name
- `params` (required) The route parameters to be used to create the path string
- `query` (optional) The query parameters to be used to create the path string
4 changes: 2 additions & 2 deletions examples/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ node app.js

Then try:

- http://localhost:3000/user/superman
- http://localhost:3000/user/superman/post/how-i-saved-the-city
- http://localhost:3000/user/superman
- http://localhost:3000/user/superman/post/how-i-saved-the-city
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"eslint": "^9.0.0",
"jest": "^29.0.0",
"pre-commit": "^1.0.7",
"prettier": "^3.0.0"
"prettier": "^3.4.2"
},
"pre-commit": [
"lint",
Expand Down

0 comments on commit 9994e19

Please sign in to comment.