Skip to content

_.isInteger([1]) returns true #252

Description

@JavaScriptDude

There is an issue with the function predictates isInteger() and isFloat() where a number is passed in an array of length 1.

eg:

_.isInteger([1])
// true
_.isFloat([1.1])
// true
// both should be false.

The fix for this should be pretty easy by just adding if (i === undefined || i === null || i instanceof Array) return false to the top of isNumeric.

This simple gate will block undefined, null and array.

Suggestions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions