Comparing version 2.0.1 to 2.1.0
@@ -68,3 +68,3 @@ /** @module conversions */ | ||
*/ | ||
const intOr = parseOr((num) => (typeof (num) == 'number') ? (num - num % 1) : parseInt(`${num}`, 10), isNumber); | ||
const intOr = parseOr(num => (typeof num === 'number' ? num - (num % 1) : parseInt(`${num}`, 10)), isNumber); | ||
@@ -71,0 +71,0 @@ /** Fixes the number of decimals of a float. |
{ | ||
"name": "keyu", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Key utilities for everyday use", | ||
@@ -16,3 +16,6 @@ "main": "index.js", | ||
"utils", | ||
"utilities", | ||
"fp", | ||
"conversions", | ||
"async", | ||
"types", | ||
"key" | ||
@@ -19,0 +22,0 @@ ], |
@@ -5,9 +5,12 @@ /** @module types */ | ||
* @argument {*} num any possible data type | ||
* @returns {boolean} indicating if is a number or not | ||
* @argument flag if you want strict numbers or not | ||
* @returns {boolean} indicating if is a number or not (the flag argument can be used to further filter strict numbers) | ||
* @example | ||
* isNumber(null) // -> false note isNaN(null) will return false instead | ||
* @example | ||
* isNumber("33", true) // -> false since the strict flag is set and "33" is not a strict number | ||
* @see [typesTest.js](https://github.com/nerac/keyu/blob/master/test/typesTest.js) | ||
* @method | ||
*/ | ||
const isNumber = num => !isNaN(num) && num !== null; | ||
const isNumber = (value, strict = false) => Boolean((typeof value === 'number' && !isNaN(value)) || (!strict && !isNaN(parseFloat(value)))); | ||
@@ -14,0 +17,0 @@ /** Checks **correctly** if the passed type is or not an **object** |
28016
12
378