Skip to content

Commit dd966ea

Browse files
committed
Fix validate: false examples in README
1 parent ead0298 commit dd966ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ toPath({ id: 'café' }) //=> "/user/caf%C3%A9"
181181
toPath({ id: '/' }) //=> "/user/%2F"
182182

183183
toPath({ id: ':/' }) //=> "/user/%3A%2F"
184-
toPath({ id: ':/' }, { encode: (value, token) => value }) //=> "/user/:/"
184+
toPath({ id: ':/' }, { encode: (value, token) => value, validate: false }) //=> "/user/:/"
185185

186186
const toPathRepeated = pathToRegexp.compile('/:segment+')
187187

@@ -193,7 +193,7 @@ const toPathRegexp = pathToRegexp.compile('/user/:id(\\d+)')
193193
toPathRegexp({ id: 123 }) //=> "/user/123"
194194
toPathRegexp({ id: '123' }) //=> "/user/123"
195195
toPathRegexp({ id: 'abc' }) //=> Throws `TypeError`.
196-
toPathRegexp({ id: 'abc' }, { validate: true }) //=> "/user/abc"
196+
toPathRegexp({ id: 'abc' }, { validate: false }) //=> "/user/abc"
197197
```
198198

199199
**Note:** The generated function will throw on invalid input. It will do all necessary checks to ensure the generated path is valid. This method only works with strings.

0 commit comments

Comments
 (0)