Skip to content

Commit

Permalink
use _.each everywhere instead of the _.forEach alias
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Aug 23, 2015
1 parent 1779e61 commit ccc3775
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion env.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function findExtendedSettings (envs) {
return key.toUpperCase().replace('CUSTOMCONNSTR_', '');
}

_.forEach(env.settings.enable, function eachEnable(enable) {
_.each(env.settings.enable, function eachEnable(enable) {
if (_.trim(enable)) {
_.forIn(envs, function eachEnvPair (value, key) {
var env = normalizeEnv(key);
Expand Down
2 changes: 1 addition & 1 deletion lib/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function init(env, ctx) {
}
}

_.forEach(data.treatments, updateTreatmentBG);
_.each(data.treatments, updateTreatmentBG);

};

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/boluswizardpreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function profileFieldsMissing (sbx) {
function pushInfo(prop, info, sbx) {
if (prop && prop.errors) {
info.push({label: 'Notice', value: 'required info missing'});
_.forEach(prop.errors, function pushError (error) {
_.each(prop.errors, function pushError (error) {
info.push({label: ' • ', value: error});
});
} else if (prop) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/cannulaage.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cage.findLatestTimeChange = function findLatestTimeChange(sbx) {

var prevDate = 0;

_.forEach(sbx.data.treatments, function eachTreatment (treatment) {
_.each(sbx.data.treatments, function eachTreatment (treatment) {
var treatmentDate = treatment.mills;
if (treatment.eventType === 'Site Change' && treatmentDate > prevDate && treatmentDate <= sbx.time) {

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/cob.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function init() {
var isDecaying = 0;
var lastDecayedBy = 0;

_.forEach(treatments, function eachTreatment(treatment) {
_.each(treatments, function eachTreatment(treatment) {
if (treatment.carbs && treatment.mills < time) {
lastCarbs = treatment;
var cCalc = cob.cobCalc(treatment, profile, lastDecayedBy, time);
Expand Down
12 changes: 6 additions & 6 deletions lib/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function init() {
};

plugins.register = function register(all) {
_.forEach(all, function eachPlugin(plugin) {
_.each(all, function eachPlugin(plugin) {
allPlugins.push(plugin);
});
};
Expand All @@ -68,7 +68,7 @@ function init() {
return settings.enable.indexOf(plugin.name) > -1;
}

_.forEach(allPlugins, function eachPlugin(plugin) {
_.each(allPlugins, function eachPlugin(plugin) {
plugin.enabled = isEnabled(plugin);
if (plugin.enabled) {
enabledPlugins.push(plugin);
Expand All @@ -78,11 +78,11 @@ function init() {
};

plugins.eachPlugin = function eachPlugin(f) {
_.forEach(allPlugins, f);
_.each(allPlugins, f);
};

plugins.eachEnabledPlugin = function eachEnabledPlugin(f) {
_.forEach(enabledPlugins, f);
_.each(enabledPlugins, f);
};

//these plugins are either always on or have custom settings
Expand All @@ -95,7 +95,7 @@ function init() {
};

plugins.eachShownPlugins = function eachShownPlugins(sbx, f) {
_.forEach(plugins.shownPlugins(sbx), f);
_.each(plugins.shownPlugins(sbx), f);
};

plugins.hasShownType = function hasShownType(pluginType, sbx) {
Expand Down Expand Up @@ -136,7 +136,7 @@ function init() {

plugins.extendedClientSettings = function extendedClientSettings (allExtendedSettings) {
var clientSettings = {};
_.forEach(clientDefaultPlugins, function eachClientPlugin (plugin) {
_.each(clientDefaultPlugins, function eachClientPlugin (plugin) {
clientSettings[plugin.name] = allExtendedSettings[plugin.name];
});
return clientSettings;
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/iob.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function init() {

var lastBolus = null;

_.forEach(treatments, function eachTreatment(treatment) {
_.each(treatments, function eachTreatment(treatment) {
if (treatment.mills <= time) {
var tIOB = iob.calcTreatment(treatment, profile, time);
if (tIOB.iobContrib > 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function init (env) {
maker.makeKeyRequests = function makeKeyRequests(event, eventName, callback) {
var selectedKeys = event.isAnnouncement ? announcementKeys : keys;

_.forEach(selectedKeys, function eachKey(key) {
_.each(selectedKeys, function eachKey(key) {
maker.makeKeyRequest(key, event, eventName, callback);
});
};
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/pluginbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function init (majorPills, minorPills, statusPills, bgStatus, tooltip) {
};

pluginBase.addForecastPoints = function addForecastPoints (points) {
_.forEach(points, function eachPoint (point) {
_.each(points, function eachPoint (point) {
point.type = 'forecast';
if (point.mgdl < 13) {
point.color = 'transparent';
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/pushover.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function init (env) {
}
}

_.forEach(selectedKeys, function eachKey(key) {
_.each(selectedKeys, function eachKey(key) {
msg.user = key;
pushover.sendAPIRequest(msg, callback);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/profilefunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function init(profileData) {

// preprocess the timestamps to seconds for a couple orders of magnitude faster operation
profile.preprocessProfileOnLoad = function preprocessProfileOnLoad(container) {
_.forEach(container, function eachValue (value) {
_.each(container, function eachValue (value) {
if( Object.prototype.toString.call(value) === '[object Array]' ) {
profile.preprocessProfileOnLoad(value);
}
Expand Down Expand Up @@ -67,7 +67,7 @@ function init(profileData) {
returnValue = valueContainer;

if( Object.prototype.toString.call(valueContainer) === '[object Array]' ) {
_.forEach(valueContainer, function eachValue (value) {
_.each(valueContainer, function eachValue (value) {
if (timeAsSecondsFromMidnight >= value.timeAsSeconds) {
returnValue = value.value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pushnotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function init(env, ctx) {
if (ctx.pushover) {
var receiptKeys = receipts.keys();

_.forEach(receiptKeys, function eachKey(receipt) {
_.each(receiptKeys, function eachKey(receipt) {
ctx.pushover.cancelWithReceipt(receipt, function cancelCallback(err) {
if (err) {
console.error('error canceling receipt, err: ', err);
Expand Down
2 changes: 1 addition & 1 deletion static/profile/js/profileeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
}

// Fill dropdown boxes
_.forEach([{prefix:'pe_basal', array:'basal', label:'Rate: '},
_.each([{prefix:'pe_basal', array:'basal', label:'Rate: '},
{prefix:'pe_ic', array:'carbratio', label:'IC: '},
{prefix:'pe_isf', array:'sens', label:'ISF: '}
], function (e) {
Expand Down

0 comments on commit ccc3775

Please sign in to comment.