Superstruct v0.5.0 Release Notes

Release Date: 2017-12-21 // over 6 years ago
  • BREAKING
    • Validators must now return true, false or an error reason string. Previously any truthy value would be considered valid. Now you can provide more information for the thrown errors by providing a string which will be attached as error.reason. However, this means that truthy string values now equate to invalid, not valid.

    • Property validators now receive data as their second argument. Previously you only had access to the property value, but now you also have access to the entire object's data.

    NEW
    • Errors can now contain reason information. Validator functions can now return string instead of a boolean, denoting the reason a value was invalid. This can then be used to create more helpful error messages.