Skip to content

Commit

Permalink
fix: path params incorrectly mutated
Browse files Browse the repository at this point in the history
fixes #1122
  • Loading branch information
jquense committed Nov 23, 2020
1 parent 5dae837 commit ba23eb7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ValidationError.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ ValidationError.isError = function (err) {
};

ValidationError.formatError = function (message, params) {
params.path = params.label || params.path || 'this';
const path = params.label || params.path || 'this';
if (path !== params.path) params = { ...params, path };

if (typeof message === 'string')
return message.replace(strReg, (_, key) => printValue(params[key]));
Expand Down

0 comments on commit ba23eb7

Please sign in to comment.