mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Update vendors.
Former-commit-id: 31e8de8842ed9ea020f54ca06cdb87b1478e3b08
This commit is contained in:
1
vendor/backbone/backbone.js
vendored
1
vendor/backbone/backbone.js
vendored
@@ -926,6 +926,7 @@
|
|||||||
// Simple proxy to `Backbone.history` to save a fragment into the history.
|
// Simple proxy to `Backbone.history` to save a fragment into the history.
|
||||||
navigate: function(fragment, options) {
|
navigate: function(fragment, options) {
|
||||||
Backbone.history.navigate(fragment, options);
|
Backbone.history.navigate(fragment, options);
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Bind all defined routes to `Backbone.history`. We have to reverse the
|
// Bind all defined routes to `Backbone.history`. We have to reverse the
|
||||||
|
|||||||
5
vendor/underscore/test/arrays.js
vendored
5
vendor/underscore/test/arrays.js
vendored
@@ -163,7 +163,10 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("lastIndexOf", function() {
|
test("lastIndexOf", function() {
|
||||||
var numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0];
|
var numbers = [1, 0, 1];
|
||||||
|
equal(_.lastIndexOf(numbers, 1), 2);
|
||||||
|
|
||||||
|
numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0];
|
||||||
numbers.lastIndexOf = null;
|
numbers.lastIndexOf = null;
|
||||||
equal(_.lastIndexOf(numbers, 1), 5, 'can compute lastIndexOf, even without the native function');
|
equal(_.lastIndexOf(numbers, 1), 5, 'can compute lastIndexOf, even without the native function');
|
||||||
equal(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element');
|
equal(_.lastIndexOf(numbers, 0), 8, 'lastIndexOf the other element');
|
||||||
|
|||||||
2
vendor/underscore/underscore-min.js
vendored
2
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
9
vendor/underscore/underscore.js
vendored
9
vendor/underscore/underscore.js
vendored
@@ -515,9 +515,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
|
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
|
||||||
_.lastIndexOf = function(array, item, fromIndex) {
|
_.lastIndexOf = function(array, item, from) {
|
||||||
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item, fromIndex);
|
var hasIndex = from != null;
|
||||||
var i = (fromIndex != null ? fromIndex : array.length);
|
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
|
||||||
|
return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
|
||||||
|
}
|
||||||
|
var i = (hasIndex ? from : array.length);
|
||||||
while (i--) if (array[i] === item) return i;
|
while (i--) if (array[i] === item) return i;
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user