"use strict"; const annotateErrors = require("./"); const ValidationError = require("@validatem/error"); let errors = [ new ValidationError("Error A"), new ValidationError("Error B", { path: [ "somewhere" ] }), ]; annotateErrors({ errors: errors, pathSegments: ["some", "path"] }); console.log(errors); /* [ { ValidationError: Error A path: [ 'some', 'path' ], ___validatem_isValidationError: true, ___validatem_errorVersion: 1, message: 'Error A' }, { ValidationError: Error B path: [ 'some', 'path', 'somewhere' ], ___validatem_isValidationError: true, ___validatem_errorVersion: 1, message: 'Error B' } ] */