| 106 | } |
| 107 | |
| 108 | static _findDuplicateError(error, errorIndex, errors) { |
| 109 | const foundIndex = errors.findIndex(($) => { |
| 110 | if ($.instancePath !== error.instancePath) { |
| 111 | return false; |
| 112 | } else if ($.keyword !== error.keyword) { |
| 113 | return false; |
| 114 | } else if (JSON.stringify($.params) !== JSON.stringify(error.params)) { |
| 115 | return false; |
| 116 | } else { |
| 117 | return true; |
| 118 | } |
| 119 | }); |
| 120 | return foundIndex !== errorIndex; |
| 121 | } |
| 122 | |
| 123 | static filterErrors(allErrors) { |
| 124 | return allErrors.filter((error, i, errors) => { |