@lazy-assert/check-basic
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.8](https://github.com/bluelovers/ws-jest/compare/@lazy-assert/check-basic@1.0.7...@lazy-assert/check-basic@1.0.8) (2022-09-19) | ||
### ✨ Features | ||
* add `isFiniteNum` ([9906469](https://github.com/bluelovers/ws-jest/commit/9906469b4c9bfb33c55b9b2fc6b16de548aae1a0)) | ||
* add `isUnSafeNumLike` ([e8e88b2](https://github.com/bluelovers/ws-jest/commit/e8e88b2a1bc1ac3bb79bf29af7214dec3cdd5e42)) | ||
## [1.0.7](https://github.com/bluelovers/ws-jest/compare/@lazy-assert/check-basic@1.0.6...@lazy-assert/check-basic@1.0.7) (2022-09-10) | ||
@@ -8,0 +19,0 @@ |
@@ -5,2 +5,3 @@ export declare function isNum(n: unknown): n is number; | ||
export declare function isFloat(n: unknown): n is number; | ||
export declare function isFiniteNum(n: unknown): n is number; | ||
export declare function isFiniteInt(n: unknown): n is number; | ||
@@ -12,3 +13,11 @@ export declare function isFiniteFloat(n: unknown): n is number; | ||
export declare function isNegative(n: unknown): n is number; | ||
/** | ||
* @see https://github.com/jonschlinkert/is-number/blob/master/index.js | ||
*/ | ||
export declare function isUnSafeNumString(n: unknown): n is string; | ||
/** | ||
* @see https://github.com/jonschlinkert/is-number/blob/master/index.js | ||
*/ | ||
export declare function isUnSafeNumLike(n: unknown): n is number | string; | ||
export {}; |
{ | ||
"name": "@lazy-assert/check-basic", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "", | ||
@@ -54,4 +54,3 @@ "keywords": [ | ||
"posttest": "yarn run build", | ||
"build": "yarn run build:tsdx && yarn run build:dts", | ||
"build:dts": "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner & echo build:dts", | ||
"build": "yarn run build:tsdx && yarn run build:dts:bundle", | ||
"build:dts:bundle": "ynpx dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle", | ||
@@ -85,3 +84,3 @@ "build:dts:copy": "copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts", | ||
}, | ||
"gitHead": "df7b52d8ef6765382a6bea20fe278956e80ba1eb" | ||
"gitHead": "9fae7dcd11d68bb58dcbfe99b736d38b619ef947" | ||
} |
@@ -1,5 +0,4 @@ | ||
export function isNum(n: unknown): n is number | ||
{ | ||
return n === +n | ||
return typeof n === 'number' && n === +n | ||
} | ||
@@ -22,5 +21,10 @@ | ||
export function isFiniteNum(n: unknown): n is number | ||
{ | ||
return isNum(n) && isFinite(n); | ||
} | ||
export function isFiniteInt(n: unknown): n is number | ||
{ | ||
return isFinite(n as any) && isInt(n) | ||
return isFiniteNum(n) && isInt(n) | ||
} | ||
@@ -30,3 +34,3 @@ | ||
{ | ||
return isFinite(n as any) && isFloat(n) | ||
return isFiniteNum(n) && isFloat(n) | ||
} | ||
@@ -53,1 +57,25 @@ | ||
} | ||
/** | ||
* @see https://github.com/jonschlinkert/is-number/blob/master/index.js | ||
*/ | ||
export function isUnSafeNumString(n: unknown): n is string | ||
{ | ||
if (typeof n === 'string') | ||
{ | ||
n = n.trim(); | ||
if (n !== '') | ||
{ | ||
return isFinite(+n) | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* @see https://github.com/jonschlinkert/is-number/blob/master/index.js | ||
*/ | ||
export function isUnSafeNumLike(n: unknown): n is number | string | ||
{ | ||
return isFiniteNum(n) || isUnSafeNumString(n) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31543
273