Changed a separator for path parameter to pre-split array approach for Joi.reach#1433
Conversation
|
Thanks, I'd like to also keep the current behavior and not introduce this as a breaking change though. It could likely be done by introducing a local function inside reach and recursively call that instead of |
|
@Marsup You mean keep current behavior and also allow to pass an array as a parameter or apply array-approach only internally? |
|
Being able to pass either a string or an array, and apply the array logic internally once you've split the string if it's a string. |
|
@Marsup Ok, I got, I'll do it |
lib/index.js
Outdated
| for (let i = 0; i < children.length; ++i) { | ||
| const child = children[i]; | ||
| if (child.key === key) { | ||
| return this.reach(child.schema, schemaPath); |
There was a problem hiding this comment.
You can call reach here, no need to go through the assert part again since it's safe.
lib/index.js
Outdated
| } | ||
| }; | ||
|
|
||
| const schemaPath = typeof path === 'string' ? path.split('.') : path; |
There was a problem hiding this comment.
Can you call .slice() in the 2nd case ? I don't want to modify input parameters.
|
@Marsup, thanks for review, I fixed my code according to your suggestions |
|
Thanks ! |
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Fixed the issue: #1383
This changed the path parameter of
Joi.reachfrom string to array of strings