path-to-regexp 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,4 +1,4 @@
1
- 2.1.0 / 2018-03-06
1
+ 2.2.0 / 2018-03-06
2
2
  ==================
3
3
 
4
4
  * Pass `token` as second argument to `encode` option (e.g. `encode(value, token)`)
package/Readme.md CHANGED
@@ -192,7 +192,7 @@ toPathRegexp({ id: 'abc' }) //=> Throws `TypeError`.
192
192
 
193
193
  Path-To-RegExp exposes the two functions used internally that accept an array of tokens.
194
194
 
195
- * `pathToRegexp.tokensToRegExp(tokens, options)` Transform an array of tokens into a matching regular expression.
195
+ * `pathToRegexp.tokensToRegExp(tokens, keys?, options?)` Transform an array of tokens into a matching regular expression.
196
196
  * `pathToRegexp.tokensToFunction(tokens)` Transform an array of tokens into a path generator function.
197
197
 
198
198
  #### Token Information
package/index.js CHANGED
@@ -305,7 +305,7 @@ function tokensToRegExp (tokens, keys, options) {
305
305
  var delimiters = options.delimiters || DEFAULT_DELIMITERS
306
306
  var endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|')
307
307
  var route = ''
308
- var isEndDelimited = false
308
+ var isEndDelimited = tokens.length === 0
309
309
 
310
310
  // Iterate over the tokens and create our regexp string.
311
311
  for (var i = 0; i < tokens.length; i++) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "path-to-regexp",
3
3
  "description": "Express style path to RegExp utility",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
7
7
  "files": [