@dotnetCarpenter dotnetCarpenter released this Sep 19, 2018 · 1 commit to master since this release

Assets 2

Fixes bug #11 - Trait.create throws if prototype === null.

const o = Trait.create(
  Trait({ a:0, b:function(){ return this.a; } }));

@dotnetCarpenter dotnetCarpenter released this Jan 1, 2018 · 8 commits to master since this release

Assets 2

Version 1.1

This release just changes how traits.js is consumed and published. A lot of other small project maintenance fixes also goes into this release but that should be transparent to you. We now publish an UMD capable version, both minified and normal, reachable from https://unpkg.com/traits.js@1/. UMD support means that traits.js can be consumed by AMD loaders (Require.JS), CommonJS loaders (Node.js) while still be accessible through the global context in the browser via the Trait reference.

We also pack src/traits.js directly in the npm module so you can import it (though you have to know the path) via ES2016 loaders when they land in browsers (currently only Safari).

import Trait from 'https://unpkg.com/traits.js@1/src/traits.js'

Support for Node.js --experimental-modules can easily be accommodated via the newly added rollup.js packager if there is interest.


  • Npm pre-publish hook now creates a dist/ directory with traits.js and traits.min.js. This allow for using the minified version through https://unpkg.com.
  • Added changelog.
  • Mention unpkg.com include option and fixed some formatting errors in markdown files.


  • Npm main file no longer points to src/traits.js but to dist/traits.js. Since this is the unminified version, your module bundler can optimize the minification process according to your project.
  • Updated dev dependencies. Note that, qunit can not be updated to any version higher than 2.4.1 due to karma-qunit.


  • Two CommonJS detections in traits.js.