1.0.7 • Published 4 years ago

looks-like-number v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

npm version Build Status Coverage Status

looks-like-number.js

General utility function to verify its argument looks like a number

Usage

var looksLikeNumb = require("looks-like-number")
var allowLeftRightSpaces = true;

looksLikeNumb(0) // true
looksLikeNumb('0') // true
looksLikeNumb('-1.2') // true
looksLikeNumb(Number.MAX_VALUE) // true
looksLikeNumb('1e15') // true
looksLikeNumb('1,5') // true

looksLikeNumb([]) // false
looksLikeNumb(new Date(1,1,2021)) // false
looksLikeNumb(undefined) // false
looksLikeNumb(null) // false
looksLikeNumb({a: '-9'}) // false
looksLikeNumb(/\d+/g) // false
looksLikeNumb(function(){ ... }) // false
looksLikeNumb(Symbol()) // false
looksLikeNumb('') // false

looksLikeNumb(' 44') // false
looksLikeNumb('15 ') // false
looksLikeNumb(' 5 ') // false
looksLikeNumb(' 44', allowLeftRightSpaces) // true
looksLikeNumb('15 ', allowLeftRightSpaces) // true
looksLikeNumb(' 5 ', allowLeftRightSpaces) // true
looksLikeNumb(' ', allowLeftRightSpaces) // false
looksLikeNumb(' 1 9 ', allowLeftRightSpaces) // false
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.5-0

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago