_.each(values, (value, seriesName) => { if (!this.series[seriesName]) { return; } if (this._isHighwater(seriesName)) { this.series[seriesName].y = _.times(this.limit, _.constant(value)); } else { this.series[seriesName].y.shift(); this.series[seriesName].y.push(value); } });
_.each(this.views, (view) => { if (view && typeof view.destroy === "function") { view.destroy(); } });
_.each(metricsProvider._aggregation, (value, key) => { expect(key) .to.be.a("string") .that.equals(AGGREGATE_TIME_LEVELS[index++]); expect(value) .to.be.an("object") .that.deep.equals({ data: [], lastTimeIndex: undefined, lastAggregateIndex: 0, scrollOffset: 0 }); });
const StreamView = function StreamView(options) { BaseView.call(this, options); assert(options.logProvider, "StreamView requires logProvider"); if (this.layoutConfig.exclude) { this.excludeRegex = new RegExp(this.layoutConfig.exclude); } if (this.layoutConfig.include) { this.includeRegex = new RegExp(this.layoutConfig.include); } this.logProvider = options.logProvider; this._createView(options); const content = options.logProvider.getLog(this.layoutConfig.streams, options.scrollback); if (content.length > 0) { this.log(content); } this._boundLog = this.log.bind(this); _.each(this.layoutConfig.streams, (eventName) => { this.logProvider.on(eventName, this._boundLog); }); }
_.each(users, (user, i) => { user.id = i + 1; delete user.avatar; delete user.gravatar; delete user.dob; delete user.website; delete user.address; delete user.ip; });
/** * Given a metric data object, construct an initialized average. * * @param {Object} data * The metric data received. * * @returns {Object} * The initialized average object is returned. */ const getInitializedAverage = function getInitializedAverage(data) { return _.reduce(data, (prev, a, dataKey) => { // create a first-level object of the key prev[dataKey] = {}; _.each(data[dataKey], (b, dataMetricKey) => { // the metrics are properties inside this object prev[dataKey][dataMetricKey] = 0; }); return prev; }, {}); }
_.each(this.layoutConfig.streams, (eventName) => { this.logProvider.removeListener(eventName, this._boundLog); });
// Strip it down _.each(process.env, (value, key) => { if (_.includes(key, prefix)) { delete process.env[key]; } });
_.each(data[0], (value, seriesName) => { if (!this.series[seriesName]) { return; } if (this._isHighwater(seriesName)) { this.series[seriesName].y = _.times(this.limit, _.constant(value)); } else { this.series[seriesName].y = _.times(this.limit, _.constant(0)); } this.series[seriesName].x = xAxis; });
_.each(posts, (post, i) => { post.id = i + 1; post.author = _.random(1, 5); });
_.each(values, (value) => { this.onEvent(value); });
_.each(users, (user, i) => user.id = i + 1);
_.each(posts, (post, i) => { post.id = i + 1; post.author = _.random(1, 5); });
_.each(users, (user, i) => user.id = i + 1);