(js) Update lodash to version 4.6.1

This commit is contained in:
Francis Lachapelle
2016-03-03 13:46:14 -05:00
parent fadf52b01e
commit d4745ef598
22 changed files with 116 additions and 118 deletions
@@ -97,7 +97,7 @@
(o.id != 'personal' &&
o.name.localeCompare(calendar.name) === 1));
});
i = sibling ? _.indexOf(_.pluck(list, 'id'), sibling.id) : 1;
i = sibling ? _.indexOf(_.map(list, 'id'), sibling.id) : 1;
list.splice(i, 0, calendar);
};
@@ -168,11 +168,11 @@
Calendar.$getIndex = function(id) {
var i;
i = _.indexOf(_.pluck(Calendar.$calendars, 'id'), id);
i = _.indexOf(_.map(Calendar.$calendars, 'id'), id);
if (i < 0)
i = _.indexOf(_.pluck(Calendar.$subscriptions, 'id'), id);
i = _.indexOf(_.map(Calendar.$subscriptions, 'id'), id);
if (i < 0)
i = _.indexOf(_.pluck(Calendar.$webcalendars, 'id'), id);
i = _.indexOf(_.map(Calendar.$webcalendars, 'id'), id);
return i;
};
@@ -335,7 +335,7 @@
else
calendars = Calendar.$calendars;
i = _.indexOf(_.pluck(calendars, 'id'), this.id);
i = _.indexOf(_.map(calendars, 'id'), this.id);
if (i > -1) {
return this.$save().then(function() {
calendars.splice(i, 1);
@@ -371,7 +371,7 @@
}
return promise.then(function() {
var i = _.indexOf(_.pluck(list, 'id'), _this.id);
var i = _.indexOf(_.map(list, 'id'), _this.id);
list.splice(i, 1);
});
};
@@ -59,11 +59,11 @@
}
function unselectComponents() {
_.each(Component['$' + vm.componentType], function(component) { component.selected = false; });
_.forEach(Component['$' + vm.componentType], function(component) { component.selected = false; });
}
function selectAll() {
_.each(Component['$' + vm.componentType], function(component) {
_.forEach(Component['$' + vm.componentType], function(component) {
component.selected = true;
});
}
@@ -49,10 +49,10 @@
},
function(newList, oldList) {
// Identify which calendar has changed
var ids = _.pluck(_.filter(newList, function(o, i) { return !_.isEqual(o, oldList[i]); }), 'id');
var ids = _.map(_.filter(newList, function(o, i) { return !_.isEqual(o, oldList[i]); }), 'id');
if (ids.length > 0) {
$log.debug(ids.join(', ') + ' changed');
_.each(ids, function(id) {
_.forEach(ids, function(id) {
var calendar = Calendar.$get(id);
calendar.$setActivation().then(function() {
$rootScope.$emit('calendars:list');
@@ -304,8 +304,6 @@
folder.$rename()
.then(function(data) {
vm.editMode = false;
}, function(data, status) {
Dialog.alert(l('Warning'), data);
});
}
@@ -158,7 +158,7 @@
angular.extend(_this.$query, params);
if (options) {
_.each(_.keys(options), function(key) {
_.forEach(_.keys(options), function(key) {
// Query parameters common to events and tasks are compared
dirty |= (_this.$query[key] && options[key] != Component.$query[key]);
if (key == 'reload' && options[key])
@@ -291,7 +291,7 @@
var reduceComponent, associateComponent;
reduceComponent = function(objects, eventData, i) {
var componentData = _.object(this.eventsFields, eventData),
var componentData = _.zipObject(this.eventsFields, eventData),
start = new Date(componentData.c_startdate * 1000);
componentData.hour = start.getHourString();
componentData.blocks = [];
@@ -316,13 +316,13 @@
data.eventsFields.splice(_.indexOf(data.eventsFields, 'c_title'), 1, 'summary');
// Instantiate Component objects
_.reduce(data.events, reduceComponent, components, data);
_.reduce(data.events, _.bind(reduceComponent, data), components);
// Associate Component objects to blocks positions
_.forEach(_.flatten(data.blocks), associateComponent, components);
_.forEach(_.flatten(data.blocks), _.bind(associateComponent, components));
// Associate Component objects to all-day blocks positions
_.each(_.flatten(data.allDayBlocks), associateComponent, components);
_.forEach(_.flatten(data.allDayBlocks), _.bind(associateComponent, components));
// Build array of dates
if (dates.length === 0)
@@ -392,14 +392,14 @@
return futureComponentData.then(function(data) {
return Component.$timeout(function() {
var fields = _.invoke(data.fields, 'toLowerCase');
var fields = _.invokeMap(data.fields, 'toLowerCase');
fields.splice(_.indexOf(fields, 'c_folder'), 1, 'pid');
fields.splice(_.indexOf(fields, 'c_name'), 1, 'id');
fields.splice(_.indexOf(fields, 'c_recurrence_id'), 1, 'occurrenceId');
// Instanciate Component objects
_.reduce(data[type], function(components, componentData, i) {
var data = _.object(fields, componentData);
var data = _.zipObject(fields, componentData);
components.push(new Component(data));
return components;
}, components);
@@ -498,7 +498,7 @@
this.due = Component.$parseDate(this.dueDate);
if (this.c_category)
this.categories = _.invoke(this.c_category, 'asCSSIdentifier');
this.categories = _.invokeMap(this.c_category, 'asCSSIdentifier');
// Parse recurrence rule definition and initialize default values
this.$isRecurrent = angular.isDefined(data.repeat);
@@ -680,7 +680,7 @@
roundedStart.setMinutes(15*startQuarter);
roundedEnd.setMinutes(15*endQuarter);
_.each(roundedStart.daysUpTo(roundedEnd), function(date, index) {
_.forEach(roundedStart.daysUpTo(roundedEnd), function(date, index) {
var currentDay = date.getDate(),
dayKey = date.getDayString(),
hourKey;
@@ -721,7 +721,7 @@
this.freebusy = this.updateFreeBusyCoverage();
if (this.attendees) {
_.each(this.attendees, function(attendee) {
_.forEach(this.attendees, function(attendee) {
attendee.image = Component.$gravatar(attendee.email, 32);
_this.updateFreeBusyAttendee(attendee);
});
@@ -763,7 +763,7 @@
// Fetch FreeBusy information
Component.$$resource.fetch(url.join('/'), 'ajaxRead', params).then(function(data) {
_.each(days, function(day) {
_.forEach(days, function(day) {
var hour;
if (angular.isUndefined(attendee.freebusy[day]))