Methods
(static) isStringAFiniteInteger(input) → {boolean}
- Description:
- Used to check if input is a finite integer.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
// returns false
let result = mdx.Utils.Validator.isStringAFiniteInteger("12.5");
Parameters:
Name | Type | Description |
---|---|---|
input |
string |
Returns:
Returns a boolean signifying whether the input was a finite integer
- Type
- boolean
(static) isStringAFiniteNumber(input) → {boolean}
- Description:
- Used to check if input is a finite number.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
// returns true
let result = mdx.Utils.Validator.isStringAFiniteNumber("12.5");
Parameters:
Name | Type | Description |
---|---|---|
input |
string |
Returns:
Returns a boolean signifying whether the input was a finite number
- Type
- boolean
(static) isValidISOTimestamp(timestamp) → {boolean}
- Description:
- Checks if input date string is in ISO 8601 format.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
let result = mdx.Utils.Validator.isValidTimestamp("2023-01-12T11:20:10.000Z");
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
string |
Returns:
Returns a boolean signifying whether the input was a valid timestamp
- Type
- boolean
(static) isValidTimeRange(fromTimestamp, toTimestamp) → {boolean}
- Description:
- Checks if input time range is valid.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
let result = mdx.Utils.Validator.isValidTimeRange("2023-01-12T11:20:10.000Z","2023-01-12T14:20:10.000Z");
Parameters:
Name | Type | Description |
---|---|---|
fromTimestamp |
string | |
toTimestamp |
string |
Returns:
Returns a boolean signifying whether the input time range was valid
- Type
- boolean
(static) validateJsonSchema(jsonInput, schema, coerceTypesopt) → {Object}
- Description:
- Checks if a json input follows a schema.
- Source:
Example
const mdx = require("@nvidia-mdx/web-api-core");
let result = mdx.Utils.Validator.validateJsonSchema(jsonInput,schema);
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
jsonInput |
Object | |||
schema |
Object | |||
coerceTypes |
boolean |
<optional> |
true
|
Returns:
Returns the validity of the json input.
- Type
- Object