Commit 1fc5f12
committed
fix: use hasOwnProperty instead of truthiness check for parameter presence in _parse
The check `!params[segments[0].name]` used truthiness to determine if a
parameter key was present, causing falsy-but-valid values like `0` to be
treated as missing. For example, `route('posts.show', { post: 0 })` would
incorrectly wrap params to `{ post: { post: 0 } }` because `!0` is `true`.
Replaced with `!params.hasOwnProperty(segments[0].name)` to check for key
presence instead.1 parent f92110a commit 1fc5f12
2 files changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
596 | 600 | | |
597 | 601 | | |
598 | 602 | | |
| |||
0 commit comments