Skip to content

Commit 20968e9

Browse files
address pr comments
1 parent 6c16db5 commit 20968e9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/validateSchema.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function validateSchema(schema, options) {
1717
const errors = options.map((options) => validateObject(schema, options));
1818
errors.forEach((list, idx) => {
1919
list.forEach(function applyPrefix(err) {
20-
err.dataPath = "[" + idx + "]" + err.dataPath;
20+
err.dataPath = `[${idx}]${err.dataPath}`;
2121
if(err.children) {
2222
err.children.forEach(applyPrefix);
2323
}
@@ -45,9 +45,7 @@ function filterErrors(errors) {
4545
newErrors = newErrors.filter((oldError) => {
4646
if(oldError.dataPath.includes(dataPath)) {
4747
if(oldError.children) {
48-
oldError.children.forEach((child) => {
49-
children.push(child);
50-
});
48+
children = children.concat(oldError.children.slice(0));
5149
}
5250
oldError.children = undefined;
5351
children.push(oldError);

0 commit comments

Comments
 (0)