Move _.pluck and _.invoke back to the "Collections" category and optimize _.sortedIndex when a callback is passed.

Former-commit-id: d16763e7d35660d8ba9ea976c8b2a4dc20f1211f
This commit is contained in:
John-David Dalton
2012-06-14 00:28:36 -04:00
parent e5555dd26a
commit 24c9b6e211
3 changed files with 112 additions and 89 deletions

View File

@@ -378,6 +378,17 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.invoke');
(function() {
test('should work with an object for `collection`', function() {
var object = { 'a': 1, 'b': 2, 'c': 3 };
deepEqual(_.invoke(object, 'toFixed', 1), ['1.0', '2.0', '3.0']);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.isEmpty');
(function() {
@@ -520,6 +531,17 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.pluck');
(function() {
test('should work with an object for `collection`', function() {
var object = { 'a': [1], 'b': [1, 2], 'c': [1, 2, 3] };
deepEqual(_.pluck(object, 'length'), [1, 2, 3]);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.reduceRight');
(function() {
@@ -743,12 +765,10 @@
'indexOf',
'initial',
'intersection',
'invoke',
'last',
'lastIndexOf',
'max',
'min',
'pluck',
'range',
'rest',
'shuffle',
@@ -782,7 +802,9 @@
'filter',
'find',
'forEach',
'invoke',
'map',
'pluck',
'reduce',
'reduceRight',
'reject',