Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
activeFeatures =
activeFeatures.filter(function (feature) {
return !contains(features, feature);
});
setFlags(activeFeatures);
this.emit('deactivated', features);
return this;
}
},
// Creates the feature toggle object by
// composing the methods above with an
// event emitter using the Stampit
// prototypal inheritance library.
ft = stampit.compose(
stampit.convertConstructor(EventEmitter),
stampit(methods)
).create();
// Kick things off by setting feature classes
// for the currently active features.
setFlags(activeFeatures);
return ft;
};
activeFeatures =
activeFeatures.filter(function (feature) {
return !contains(features, feature);
});
setFlags(activeFeatures);
this.emit('deactivated', features);
return this;
}
},
// Creates the feature toggle object by
// composing the methods above with an
// event emitter using the Stampit
// prototypal inheritance library.
ft = stampit.compose(
stampit.convertConstructor(EventEmitter),
stampit(methods)
).create();
// Kick things off by setting feature classes
// for the currently active features.
setFlags(activeFeatures);
return ft;
};
'use strict';
var stampit = require('stampit'),
EventEmitter = require('events').EventEmitter,
events = stampit.convertConstructor(EventEmitter),
dotty = require('dotty');
module.exports = function makeConfig(sources) {
return stampit.compose(events)
.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.
'use strict';
const stampit = require('stampit');
const EventEmitter = require('events').EventEmitter;
/**
* Turn a node `EventEmitter` into a Stamp.
*
* @copyright Copyright (c) 2016, Derek Rosenzweig
* @author Derek Rosenzweig
* @package Formation
* @namespace Formation.eventEmitter
* @mixin Formation.eventEmitter
*/
const eventEmitterStamp = stampit.convertConstructor(EventEmitter);
/**
* Provides an interface for defining Formation Node events.
*
* @copyright Copyright (c) 2016, Derek Rosenzweig
* @author Derek Rosenzweig
* @package Formation
* @namespace Formation.eventEmitterEvents
* @mixin Formation.eventEmitterEvents
*
* @mixes Formation.eventEmitter
*/
const eventEmitterEventsStamp = stampit()
.init(function() {
/**
}
}
return null;
}
export {validate};
/**
* Simple wrapper around `EventEmitter`
* @constructor
* @type {EventEmittable}
* @example {@lang javascript}
* var EmittableModel = stampit().compose(EventEmittable);
*/
export const EventEmittable = stampit.convertConstructor(EventEmitter);
/**
* Used as a manager for {@link Syncano} base object. **Not** meant to be used directly.
* @constructor
* @type {ConfigMixin}
* @property {Syncano} _config private attribute which holds {@link Syncano} object
* @example {@lang javascript}
* var MyStamp = stampit().compose(ConfigMixin);
*/
export const ConfigMixin = stampit({
methods: {
/**
* Gets default properties.
'use strict';
let stampit = require('stampit');
let EventEmitter = require('events').EventEmitter;
let EventEmittable = stampit.convertConstructor(EventEmitter);
let Joi = require('joi');
let _ = require('digs-utils');
let define = require('digs-utils/define');
const DigsObject = define({
init: function init(context) {
const digs = _.first(context.args);
Joi.assert(digs, Joi.object({
settings: Joi.object({
app: Joi.object({
namespace: Joi.string()
.required(),
project: Joi.string()
.required()
})
.required()
return history[history.length - 1];
};
const update = function update (value) {
if (state() === value) return;
const previous = state();
history.push(value);
instance.emit('change', {value, previous});
};
history.push(immutable.fromJS(obj));
stamp =
stampit.convertConstructor(events.EventEmitter)
.methods({
get (key) {
return state().getIn(dp(key));
},
set (key, val) {
update(state().setIn(dp(key), val));
return this;
},
remove (key) {
update(state().removeIn(dp(key)));
return this;
},
toJS () {
return state().toJS();
}
})