jonschlinkert / is-number

JavaScript/Node.js utility. Returns `true` if the value is a number or string number. Useful for checking regex match results, user input, parsed strings, etc.
https://github.com/jonschlinkert
MIT License
260 stars 50 forks source link

Support Number (objects) #24

Closed omrilotan closed 5 years ago

omrilotan commented 5 years ago

Address issue #18

The check is not very expensive

# all
v6.2:
v6.1 x 234,123 ops/sec ±4.36% (79 runs sampled)
fastest is 'v6.1'

# string
v6.2:
v6.1 x 1,957,712 ops/sec ±8.42% (70 runs sampled)
fastest is 'v6.1'

# number
v6.2:
v6.1 x 2,165,615 ops/sec ±6.08% (75 runs sampled)
fastest is 'v6.1'
jonschlinkert commented 5 years ago

I appreciate the PR but will have to decline. Using new Number() isn't a good practice, and I've never actually seen it used in code. Thanks, and please feel free to do another PR anytime.