How to use the stampit.extend function in stampit

To help you get started, we’ve selected a few stampit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ericelliott / irecord / source / index.js View on Github external
toJS () {
        return state().toJS();
      }
    })
    .init(function () {
      const source = Rx.Observable.fromEvent(
        this, 'change',
        (ev) => ev[0]);

      this.subscribe = source.subscribe.bind(source);
      this.filter = source.filter.bind(source);
    });

  instance = stamp.create();

  return stampit.extend(
    instance,
    { stamp }
  );
};
github ericelliott / qconf / lib / make-config.js View on Github external
.enclose(function () {
      var factory = stampit(),
          attrs = factory
            .state.apply(factory, 
              sources)
            .create();

      return stampit.extend(this, {
        /**
         * Return the value of the attribute requested.
         * @param  {String} attr The name of the attribute to return.
         * @return {Any} The value of the requested attribute.
         */
        get: function get(attr) {
          var val = dotty.get(attrs, attr);
          if (val === undefined) {
            this.emit('undefined',
              'WARNING: Undefined environment variable: ' + attr, attr);
          }
          return val;
        },
        /**
         * Set the value of an attribute.
         * @param {String} attr  The name of the attribute to set.

stampit

Create objects from reusable, composable behaviors.

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis