Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Releases: bluefeet/o-js

v0.2.0

06 Dec 03:17
Compare
Choose a tag to compare

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 and attributeTraits arguments for defining the is and traits 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.

v0.1.0

09 Nov 04:24
Compare
Choose a tag to compare

This release contains two major changes.

First, a new declarative syntax for creating classes and traits. Depending on your style or requirements this new declarative syntax may fit your needs much better. Read more about it here.

Secondly, type validation can now be disabled globally or within a specific scope. This can provide a huge performance increase for situations that call for it. Read more about it here.

Global

  • Use a more condensed for loop, using in, when going over arrays.
  • Added a current branch to the GitHub repo for tracking the latest release from a single ref.

Traits

  • Add a declarative interface for defining new traits and classes.

Types

  • Added an o.disableTypeValidation() function for situations where validation may be traded for better performance.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.11

09 Nov 04:03
Compare
Choose a tag to compare

Global

  • Added a .lvimrc file to enforce indentation style (requires the vim-localvimrc plugin).
  • Default o.Class, o.Trait, and o.Attribute constructor arguments to an empty object (o.Type was already doing this).
  • Moved wiki documentation into the main repo so that it is versioned along with the code.

Traits

  • Recursively set child trait attribute arguments when calling setFromArgs. This means that when making a class instance that arguments for child trait attributes will now be applied as they should have been.

Attributes

  • Use the new identifier type instead of the nonEmptyString type for various arguments such as key, predicate, etc.

Types

Visit o-js.com for downloads, documentation, and other resources.

v0.0.10

09 Mar 21:29
Compare
Choose a tag to compare

This release is a backend release which introduces Grunt, JSHint, and UglifyJS. Using these tools (JSHint especially) lead to several code changes which will make things a bit more browser-compatible as well as standards compliant.

Global

  • Use Grunt for build tools.
  • Lots of reworking of the build tools - much less room for human error.
  • Created an Object.getPrototypeOf() shim which calls proto if not available in order to support older browsers. This is available as the plumbing function o.getPrototypeOf().

Visit o-js.com for downloads, documentation, and other resources.

v0.0.9

05 Feb 08:00
Compare
Choose a tag to compare

This release completely reorganizes the o.js code to remove the web-specific hacks and fully embrace the CommonJS/Node.js module format. Several internal tools have been built as well to produce the web-ready versions of o.js. This cleans up things quite a bit and even provides the possibility to build custom versions of o.js that only include those features that you need.

In addition to the above a lot of other small tweaks, clarifications, and enhancements have been made. The most major change being that o.Constructor has been renamed to o.Class. Do note that o.js is still being designed and that there is no guarantee of API stability until we decide to release v1.0.0. Despite that, o.js is beginning to leave adolescence and is entering maturity, so v1.0.0 shouldn't be too far off.

Global

  • Migrated everything to CommonJS format modules (no more hacks for the web, those will be handled independently).
  • Better error messaging across the board (no more "..." errors).
  • Lots of adjustments to reduce the minified size by several kilobytes.
  • Created several utilities in the bin directory for creating combined and minified versions of o.js.
  • Combined o.js and minified o-min.js are now shipped within the o-js repository.

Classes

  • Renamed o.Constructor to o.Class, because that is what it is and it is less to type.

Traits

  • Added requires attribute to o.Trait so that traits can declare a base-line interface that they require to be installed onto an object.

Types

  • Added o.simpleObjectType for checking if an object's constructor is Object.
  • Added o.typeType, o.attributeType, o.traitType, and o.classType for validating and coercing o.js's built-in object types.
  • ArrayOfType and ObjectOfType now apply their inner type's coercions.
  • Greatly simplify the trait type.
  • InstanceOfType declares a coercion that will create a new instance using the value as arguments to the constructor.
  • Added o.positiveIntType due to this type being a common case.

Plumbing

  • Exposed o.ucFirst to the public.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.8

04 Jan 07:35
Compare
Choose a tag to compare

Lots of great new type features and shortcuts created as a result of real-world application.

  • In addition to accepting an Array, o.DuckType now accepts an Object, allowing for type checking.
  • Added o.PatternType for creating types that match against a RegExp.
  • Added bower.json so that Bower has some more info about this package.
  • Attribute/Trait.install() now supports a second argument for specifying the value of the attribute(s).
  • The attributes attribute of Trait is now an object instead of an array.
  • Added o.local() to localize object property changes to a scope.
  • Attribute properties reader, writer, predicate, and clearer now take false instead of null.
  • An attribute's writer property now defaults to false to support the best practice of immutable objects.
  • Avoid a race condition when filters depend on other attributes being set during object construction.
  • Added a builder argument to o.writer and o.Attribute which provides a method-based alternative to devoid.
  • Constructors now get a trait applied to them that exposes a type and trait attribute.
  • Traits now have a type attribute which returns a Duck type that can be used to validate that an object exposes an interface compatible with the trait.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.7

09 Jul 04:24
Compare
Choose a tag to compare

The big highlights of this release are a smaller minified file (11K), and attributes can now be re-used among multiple o.Trait and o.Constructor calls.

  • Attributes on Traits (and Constructors) can now be pre-made o.Attribute objects which may be re-used.
  • Optimize some bits to produce a smaller minified output.
  • Remove o.is functions.. again, they are a nice-to-have that just bloats things.
  • Remove the special initArgs for attributes and traits in Attribute.
  • Support Travis CI.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.5

09 Jul 04:05
Compare
Choose a tag to compare

There was a minification bug in v0.0.4 having to do with trailing commas. This releas is just an update to include a fix for this so that the libraries can be published on the site in minified form.

In the future we’ll include minification in the build process before every release.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.4

09 Jul 04:06
Compare
Choose a tag to compare

This version of o.js includes a new attribute library that exposes an o.Attribute constructor for creating attributes that can be applied to objects. Other changes as well, see below:

  • Remove the option definition property.
  • Rename o.extend to o.augment.
  • Rename the default definition property to devoid.
  • Rename the extends definition property to augments.
  • Rename the isa definition property to type.
  • New primitive and object types for boolean, string, and number.
  • Added the nonEmptyString type.
  • Rename the extends type to instanceOf.
  • Added the typeOf type.
  • New arrayOf and objectOf types.
  • New attribute extention (o-attribute.js).
  • Add versions and version checking to the libraries.

Visit o-js.com for downloads, documentation, and other resources.

v0.0.3

09 Jul 04:07
Compare
Choose a tag to compare

This release includes one major enhancement: A types library (o-types.js) that provides advanced standalone validation, as well as validation types for the isa definition property.

Visit o-js.com for downloads, documentation, and other resources.