Defines a set of utility methods for performing data conversions for JSON
along with data validation.
- Source:
Methods
(static) checkHasProperty(params) → {boolean}
Determines if the specified object has the specified property.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
obj |
object
|
The object to check for the key. |
key |
string
|
The property to check for. |
|
- Source:
Returns:
true if property was found, false otherwise.
-
Type
-
boolean
(static) checkType(params) → {boolean}
Utility to check parameters of a function to ensure they are of an
expected type.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Attributes |
Description |
type |
string
|
any
|
|
The specified type to check the data
against. |
data |
any
|
|
The parameter to be checked. |
count |
number
|
<optional>
|
Checks the data parameter function
signature to ensure the appropriate number of parameters are
specified. |
|
- Source:
Returns:
true if it meets the expectations, false otherwise.
-
Type
-
boolean
(static) checkValidUrl(params) → {boolean}
Checks for a valid URL.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
data |
string
|
String to parse to see if it is a valid URL. |
|
- Source:
Returns:
true if valid, false otherwise.
-
Type
-
boolean
(static) jsonParse(params) → {object|null}
Converts a string to a JavaScript object.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
data |
string
|
The data to parse. |
|
- Source:
Returns:
Object or null if the parse failed.
-
Type
-
object
|
null
(static) jsonStringify(params) → {string|null}
Converts a JavaScript object into a string.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
data |
object
|
An object with valid JSON attributes. |
|
- Source:
Returns:
The string representation or null if the
stringify failed.
-
Type
-
string
|
null
(static) tryHasProperty(params) → {void}
Determines if the specified object has the specified property.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
obj |
object
|
The object to check for the key. |
key |
string
|
The property to check for. |
|
- Source:
Throws:
-
if the property is not found.
-
-
Type
-
SyntaxError
Returns:
-
Type
-
void
(static) tryType(params) → {void}
Utility to check parameters of a function to ensure they are of an
expected type.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Attributes |
Description |
type |
string
|
any
|
|
he specified type to check the data
against. |
data |
any
|
|
The parameter to be checked. |
count |
number
|
<optional>
|
Checks the data parameter function
signature to ensure the appropriate number of parameters are
specified. |
|
- Source:
Throws:
-
if the type was not as expected
-
-
Type
-
SyntaxError
Returns:
-
Type
-
void
(static) tryValidUrl(params) → {void}
Checks for a valid URL.
Parameters:
Name |
Type |
Description |
params |
object
|
The named parameters.
Properties
Name |
Type |
Description |
data |
string
|
String to parse to see if it is a valid URL. |
|
- Source:
Throws:
-
If v is not a valid url.
-
-
Type
-
SyntaxError
Returns:
-
Type
-
void