<commit_before># Universal Router Change Log

All notable changes to this project will be documented in this file.

## [v4.2.0] - 2017-09-20

- Correctly handle trailing slashes in paths of routes
  ([#124](https://github.com/kriasoft/universal-router/pull/124))<br>
  If you are using trailing slashes in your paths, then the router will match urls only with trailing slashes:
  ```js
  const routes = [
    { path: '/posts', ... },  // matches both "/posts" and "/posts/"
    { path: '/posts/', ... }, // matches only "/posts/"
  ];
  ```
- Generate url from first path for routes with an array of paths
  ([#124](https://github.com/kriasoft/universal-router/pull/124))
  ```js
  const router = new UniversalRouter({
    name: 'page',
    path: ['/one', '/two', /RegExp/], // only first path is used for url generation
  });
  const url = generateUrls(router);
  url('page'); // => /one
  ```

## [v4.1.0] - 2017-09-20

- Support for using the same param name in array of paths ([#122](https://github.com/kriasoft/universal-router/pull/122))

## [v4.0.0] - 2017-09-15

- Rename `router.resolve({ path })` to `router.resolve({ pathname })`
  (BREAKING CHANGE [#114](https://github.com/kriasoft/universal-router/pull/114))
- Rename `context.url` to `context.pathname`
  (BREAKING CHANGE [#114](https://github.com/kriasoft/universal-router/pull/114))
- Remove `pretty` option from `generateUrls(router, options)` function in favor of new `encode` option
  (BREAKING CHANGE [#111](https://github.com/kriasoft/universal-router/pull/111))
- Update [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to v2.0.0, see
  [changelog](https://github.com/pillarjs/path-to-regexp/blob/1bf805251c8486ea44395cd12afc37f77deec95e/History.md#200--2017-08-23)
  (BREAKING CHANGE [#111](https://github.com/kriasoft/universal-router/pull/111))
  - Explicitly handle trailing delimiters (e.g. `/test/` is now treated as `/test/` instead of `/test` when matching)
  - No wildcard asterisk (`*`) - use parameters instead (`(.*)`)
- Add support for repeat parameters ([#116](https://github.com/kriasoft/universal-router/pull/116))
- Add `encode` option to `generateUrls(router, options)` function for pretty encoding
  (e.g. pass your own implementation) ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Preserve `context.keys` values from the parent route ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Inherit `context.params` and `queryParams` from
  [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
  (e.g. `params.hasOwnProperty()` won't throw an exception anymore)
  ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Include the source code of the router in the [npm package](https://www.npmjs.com/package/universal-router)
  ([#110](https://github.com/kriasoft/universal-router/pull/110))

## [v3.2.0] - 2017-05-10

- Add `stringifyQueryParams` option to `generateUrls(router, options)` to generate URL with
  [query string](http://en.wikipedia.org/wiki/Query_string) from unknown route params
  ([#93](https://github.com/kriasoft/universal-router/pull/93))

## [v3.1.0] - 2017-04-20

- Fix `context.next()` for multiple nested routes
  ([#91](https://github.com/kriasoft/universal-router/pull/91))
- Add `pretty` option for `generateUrls(router, options)` to prettier encoding of URI path segments
  ([#88](https://github.com/kriasoft/universal-router/pull/88))
- Add source maps for minified builds ([#87](https://github.com/kriasoft/universal-router/pull/87))
- Include UMD builds to the git repository

## [v3.0.0] - 2017-03-25

- Update Router API (BREAKING CHANGE)
  ```js
  import Router from 'universal-router';
  const router = new Router(routes, options);
  router.resolve({ path, ...context }); // => Promise<any>

  // previously
  import { resolve } from 'universal-router';
  resolve(routes, { path, ...context }); // => Promise<any>
  ```<commit_msg>Add migration guide from v3 to v4 to changelog<commit_after># Universal Router Change Log

All notable changes to this project will be documented in this file.

## [v4.2.0] - 2017-09-20

- Correctly handle trailing slashes in paths of routes
  ([#124](https://github.com/kriasoft/universal-router/pull/124))<br>
  If you are using trailing slashes in your paths, then the router will match urls only with trailing slashes:
  ```js
  const routes = [
    { path: '/posts', ... },  // matches both "/posts" and "/posts/"
    { path: '/posts/', ... }, // matches only "/posts/"
  ];
  ```
- Generate url from first path for routes with an array of paths
  ([#124](https://github.com/kriasoft/universal-router/pull/124))
  ```js
  const router = new UniversalRouter({
    name: 'page',
    path: ['/one', '/two', /RegExp/], // only first path is used for url generation
  });
  const url = generateUrls(router);
  url('page'); // => /one
  ```

## [v4.1.0] - 2017-09-20

- Support for using the same param name in array of paths ([#122](https://github.com/kriasoft/universal-router/pull/122))
  ```js
  const router = new UniversalRouter({
    path: ['/one/:parameter', '/two/:parameter'],
    action: context => context.params,
  });

  router.resolve('/one/a'); // => { parameter: 'a' }
  router.resolve('/two/b'); // => { parameter: 'b' }
  ```

## [v4.0.0] - 2017-09-15

- Rename `router.resolve({ path })` to `router.resolve({ pathname })`
  (BREAKING CHANGE [#114](https://github.com/kriasoft/universal-router/pull/114))
- Rename `context.url` to `context.pathname`
  (BREAKING CHANGE [#114](https://github.com/kriasoft/universal-router/pull/114))
- Remove `pretty` option from `generateUrls(router, options)` function in favor of new `encode` option
  (BREAKING CHANGE [#111](https://github.com/kriasoft/universal-router/pull/111))
- Update [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to v2.0.0, see
  [changelog](https://github.com/pillarjs/path-to-regexp/blob/1bf805251c8486ea44395cd12afc37f77deec95e/History.md#200--2017-08-23)
  (BREAKING CHANGE [#111](https://github.com/kriasoft/universal-router/pull/111))
  - Explicitly handle trailing delimiters (e.g. `/test/` is now treated as `/test/` instead of `/test` when matching)
  - No wildcard asterisk (`*`) - use parameters instead (`(.*)`)
- Add support for repeat parameters ([#116](https://github.com/kriasoft/universal-router/pull/116))
- Add `encode` option to `generateUrls(router, options)` function for pretty encoding
  (e.g. pass your own implementation) ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Preserve `context.keys` values from the parent route ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Inherit `context.params` and `queryParams` from
  [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
  (e.g. `params.hasOwnProperty()` won't throw an exception anymore)
  ([#111](https://github.com/kriasoft/universal-router/pull/111))
- Include the source code of the router in the [npm package](https://www.npmjs.com/package/universal-router)
  ([#110](https://github.com/kriasoft/universal-router/pull/110))

**Migration from v3 to v4:**
- Change `router.resolve({ path, ... })` to `router.resolve({ pathname, ... })`
- Remove trailing slashes from all paths of your routes, i.e.
  - `path: '/posts/:uri/'` => `path: '/posts/:uri'`
  - `path: '/posts/'` => `path: '/posts'`
  - `path: '/'` => `path: ''`
  - etc.
- Replace `path: '*'` with `path: '(.*)'` if any
- If you are using webpack, change [rule](https://webpack.js.org/configuration/module/#rule) (loader) for `.js` files to include `.mjs` extension, i.e.
  - `test: /\.js$/` => `test: /\.m?js$/`

## [v3.2.0] - 2017-05-10

- Add `stringifyQueryParams` option to `generateUrls(router, options)` to generate URL with
  [query string](http://en.wikipedia.org/wiki/Query_string) from unknown route params
  ([#93](https://github.com/kriasoft/universal-router/pull/93))

## [v3.1.0] - 2017-04-20

- Fix `context.next()` for multiple nested routes
  ([#91](https://github.com/kriasoft/universal-router/pull/91))
- Add `pretty` option for `generateUrls(router, options)` to prettier encoding of URI path segments
  ([#88](https://github.com/kriasoft/universal-router/pull/88))
- Add source maps for minified builds ([#87](https://github.com/kriasoft/universal-router/pull/87))
- Include UMD builds to the git repository

## [v3.0.0] - 2017-03-25

- Update Router API (BREAKING CHANGE)
  ```js
  import Router from 'universal-router';
  const router = new Router(routes, options);
  router.resolve({ path, ...context }); // => Promise<any>

  // previously
  import { resolve } from 'universal-router';
  resolve(routes, { path, ...context }); // => Promise<any>
  ```
{'fraction_non_alphanumeric': 0.17826534110387385, 'fraction_numerical': 0.04433778996686093, 'mean_word_length': 3.908581043185642, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 22, 'https://': 41, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2789746', 'n_tokens_mistral': 3255, 'n_tokens_neox': 2903, 'n_words': 723}