$scope.Contact.title = $scope.doctitles[$scope.doctitles.resolveFunction(function(z) {
return z.id == $localStorage.data.contacts[$localStorage.data.itemID].title.id;
})];
You can easily swap out the lambda with a separate function.
UPDATE: As findIndex is an ES6 feature, you have the option to use this workaround:
if (!Array.prototype.findIndex) {
Array.prototype.findIndex = function(predicate) {
if (this == null) {
throw new TypeError('Calling Array.prototype.findIndex on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var j = 0; j < length; j++) {
value = list[j];
if (predicate.call(thisArg, value, j, list)) {
return j;
}
}
return -1;
};
}
Cited from https://developer.mozilla.org/pl/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex