mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17: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.compat.js
vendored
8
dist/lodash.compat.js
vendored
@@ -3230,7 +3230,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)) {
|
||||
@@ -3386,7 +3386,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)) {
|
||||
@@ -3508,7 +3508,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)) {
|
||||
@@ -3696,7 +3696,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