After being introduced to traits.js about a month ago and realizing I had a use case, I finally sat down this weekend to learn the library and begin my work with it.
To make life easier, I wanted the library to be available on bower, in addition to npm. So, I decided to create a fork on GitHub; but more than that, I retooled it with respect to npm "scripts", a mocha/chai test suite, and so on (made for a good way to learn also):
$ npm install traits.js
-- and/or --
$ bower install traits.js
The initial git tag and corresponding releases on bower and npm match up exactly with the 0.4 release of the original, with one difference which I will explain below. In future releases, I may alter and add to the API, and I do plan on dropping the integrated ES5 shims in favor of using a library-dependency for that purpose. But my 0.4.0 release will always be a match for the original.
The only thing that's different is that the `Trait` constructor lives on the exported object (as may other facilities in future releases). So you would do something like:
var Trait = require("traits.js").Trait; // Node.js
-- or --
Trait = traits.Trait // browser global scope
I hope other JS devs will find this useful, and I want to thank Tom for his excellent work on this gem of a library. I've tried to give ample credit and pointers to the original library/author. I don't wish to give anyone the impression I'm claiming the library as my own work.
One final note: the "browser reporter" for mocha is a bit on the slow side -- it can take anywhere from 10x - 50x as long to run the tests in a browser as compared to qunit. We're still talking fractions of a second in Chrome to two seconds on an iPad, but I thought some folks might notice so I wanted to give a heads up. Note that it's the "browser reporter" that's slow -- the library itself hasn't suffered any inherent slowdowns by way of my fork/retooling, and the tests run super fast under Node.js.
Best regards.
--
Michael Bradley, Jr.
@michaelsbradley