Skip to content

Commit 68d2526

Browse files
committed
Limit fix
1 parent 223c94a commit 68d2526

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/utils/array/Add.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var Add = function (array, item, limit, callback, context)
3131
{
3232
if (context === undefined) { context = array; }
3333

34-
if (limit)
34+
if (limit > 0)
3535
{
3636
var remaining = limit - array.length;
3737

@@ -86,7 +86,7 @@ var Add = function (array, item, limit, callback, context)
8686
return null;
8787
}
8888

89-
if (limit && itemLength > remaining)
89+
if (limit > 0 && itemLength > remaining)
9090
{
9191
item.splice(remaining);
9292

src/utils/array/AddAt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var AddAt = function (array, item, index, limit, callback, context)
3535
if (index === undefined) { index = 0; }
3636
if (context === undefined) { context = array; }
3737

38-
if (limit)
38+
if (limit > 0)
3939
{
4040
var remaining = limit - array.length;
4141

@@ -91,7 +91,7 @@ var AddAt = function (array, item, index, limit, callback, context)
9191
}
9292

9393
// Truncate to the limit
94-
if (limit && itemLength > remaining)
94+
if (limit > 0 && itemLength > remaining)
9595
{
9696
item.splice(remaining);
9797

0 commit comments

Comments
 (0)