To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack
Other utilities
autoBind(obj, props) (d/auto-bind)
Define methods which will be automatically bound to its instances
var d = require('d');var autoBind = require('d/auto-bind');var Foo = function () { this._count = 0; };Object.defineProperties(Foo.prototype, autoBind({ increment: d(function () { ++this._count; });}));var foo = new Foo();// Increment foo counter on each domEl clickdomEl.addEventListener('click', foo.increment, false);
lazy(obj, props) (d/lazy)
Define lazy properties, which will be resolved on first access
var d = require("d");var lazy = require("d/lazy");var Foo = function () {};Object.defineProperties(Foo.prototype, lazy({ items: d(function () { return []; }) }));var foo = new Foo();foo.items.push(1, 2); // foo.items array created and defined directly on foo
Tests
$ npm test
Security contact information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.