This repository has been archived by the owner on Mar 6, 2019. It is now read-only.
This release is a major overhaul and breaks backwards compatibility in several ways. This release gets us much closer to a stable v1.0.0 release. There are two major improvements in this release.
First, type validation now produces contextual errors making it much easier to figure out what value failed validation and what validation rule it failed on. Secondly, attributes now install as properties instead of functions. Besides that there were a bunch of nitty-gritty changes improving things all over the place. See the detailed change log, below, for more information. Enjoy!
BREAKING
- Attributes are now installed as properties instead of functions. This means o.js is more in-line with modern JavaScript practices but completely breaks backwards compatibility.
- Methods will now be installed before traits rather than after. This means that a trait's requires setting may require methods, which is just about the most important use of requires. This also means that a trait's around/before/after modfiers will be applied to the object which is being installed to. Note that attributes are still applied after traits.
Global
- RIP Jam.
- Lots of documentation cleanup.
- Created a new bootstrap module that is used to simplify cases where a module needs to access itself or access another module which requires it. This also simplified the generation of the combined o.js slightly.
- Enabled strict mode in the combined o.js.
- Enabled strict mode inside of each module.
- Undo "Use a more condenced for loop, using
in
, when going over arrays" from v0.1.0 - turns out that wasn't a great idea.
Traits
- The requires argument now uses the DuckType to validate the object which the trait is being applied to. This is backwards compatible because a duck type given an array works just like how requires worked with an array. But, now, an object may be passed as well which can be used to require not only the existence of the property, but its type.
- Added the
is
argument for applying built-in class traits. - Added the
attributesAre
andattributeTraits
arguments for defining theis
andtraits
arguments for new attributes.
Attributes
- Attributes install on objects as properties now instead of functions. The one exception is the installed clearer is still a function (because that makes sense).
- Attribute attributes are now installed as properties. This really only matters if you interact with attribute objects directly.
- Added the
is
argument for applying built-in attribute traits. - A
traits
argument is now supported, allowing attribute behavior to be customized.
Types
- Types now throw a custom o.TypeValidationError object when validation fails.
- Errors thrown when validation fails now include much more information about what failed and why it failed.
- Added the new o.TupleType and o.LazyType types.
Plumbing
- Adjust o.augment() to set the constructor's protoytype's constructor to the parent constructor.
- Added o.prependIdentifier().
- Removed o.proxy() and o.accessor().
Visit o-js.com for downloads, documentation, and other resources.