@alicloud/tea-util
Advanced tools
Comparing version 1.4.5 to 1.4.6
@@ -0,1 +1,4 @@ | ||
2023-06-26 Version: 1.4.6 | ||
1. Support static method `assertAsInteger()` | ||
2022-11-16 Version: 1.4.5 | ||
@@ -2,0 +5,0 @@ 1. Support ca params for server and client |
@@ -62,2 +62,7 @@ /// <reference types="node" /> | ||
static assertAsNumber(value: any): number; | ||
/** | ||
* Assert a value, if it is a integer, return it, otherwise throws | ||
* @return the integer value | ||
*/ | ||
static assertAsInteger(value: any): number; | ||
static assertAsMap(value: any): { | ||
@@ -64,0 +69,0 @@ [key: string]: any; |
@@ -197,2 +197,12 @@ "use strict"; | ||
} | ||
/** | ||
* Assert a value, if it is a integer, return it, otherwise throws | ||
* @return the integer value | ||
*/ | ||
static assertAsInteger(value) { | ||
if (Number.isInteger(value)) { | ||
return value; | ||
} | ||
throw new Error(`The value is not a int number`); | ||
} | ||
static assertAsMap(value) { | ||
@@ -199,0 +209,0 @@ if (value && typeof value === 'object' && !Array.isArray(value)) { |
{ | ||
"name": "@alicloud/tea-util", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/client.js", |
@@ -222,2 +222,13 @@ import { Readable } from 'stream'; | ||
/** | ||
* Assert a value, if it is a integer, return it, otherwise throws | ||
* @return the integer value | ||
*/ | ||
static assertAsInteger(value: any): number { | ||
if (Number.isInteger(value)) { | ||
return value; | ||
} | ||
throw new Error(`The value is not a int number`); | ||
} | ||
static assertAsMap(value: any): { [key: string]: any } { | ||
@@ -224,0 +235,0 @@ if (value && typeof value === 'object' && !Array.isArray(value)) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25982
612