mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Ensure _.first, _.initial, _.last, and _.rest work with string and objects for callback.
Former-commit-id: f587a5d11164c1c6fa050feccfb05956fd82a0d0
This commit is contained in:
8
dist/lodash.underscore.js
vendored
8
dist/lodash.underscore.js
vendored
@@ -2581,7 +2581,7 @@
|
||||
var n = 0,
|
||||
length = array.length;
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
if (typeof callback != 'number' && callback != null) {
|
||||
var index = -1;
|
||||
callback = createCallback(callback, thisArg);
|
||||
while (++index < length && callback(array[index], index, array)) {
|
||||
@@ -2737,7 +2737,7 @@
|
||||
var n = 0,
|
||||
length = array.length;
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
if (typeof callback != 'number' && callback != null) {
|
||||
var index = length;
|
||||
callback = createCallback(callback, thisArg);
|
||||
while (index-- && callback(array[index], index, array)) {
|
||||
@@ -2847,7 +2847,7 @@
|
||||
var n = 0,
|
||||
length = array.length;
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
if (typeof callback != 'number' && callback != null) {
|
||||
var index = length;
|
||||
callback = createCallback(callback, thisArg);
|
||||
while (index-- && callback(array[index], index, array)) {
|
||||
@@ -3035,7 +3035,7 @@
|
||||
* // => [{ 'name': 'beet', 'type': 'vegetable' }]
|
||||
*/
|
||||
function rest(array, callback, thisArg) {
|
||||
if (typeof callback == 'function') {
|
||||
if (typeof callback != 'number' && callback != null) {
|
||||
var n = 0,
|
||||
index = -1,
|
||||
length = array ? array.length : 0;
|
||||
|
||||
Reference in New Issue
Block a user