Superstruct v0.3.0 Release Notes

Release Date: 2017-11-30 // over 6 years ago
  • BREAKING
    • The validate() method now returns [ error, result ]. Previously it only had a single return value, which necessitated extra type checking to see if the value was an error or a result. Now you can just destructure the array to get either return value, for easier coding.

    • Errors have been simplified, removing "codes". Previously there were multiple types of errors that were thrown and you could differentiate between them with the error.code property. But the other properties of the error already let you infer the code, so having multiple types of errors made for a larger API surface without much benefit.