- Source:
- Author:
-
- Copyright:
- 2014-2023, Nick Campbell (wrapper)
- License:
Plain Old Javascript Object Parser mixin for ish.js
Methods
[mixin]
ish.type.obj.pojo(x, vDefaultValopt, oOptionsopt) → {Array.<object>}
- Source:
- See:
-
Parses the passed value as a string representing a Plain Old Javascript Object (POJO).
From Mixin: ish.type.obj.pojo.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Description |
x |
string
|
|
Value representing the POJO data to parse. |
vDefaultVal |
variant
|
<optional>
|
Value representing the default return value if parsing fails. |
oOptions |
object
|
<optional>
|
Value representing the following options:
Properties
Name |
Type |
Attributes |
Default |
Description |
context |
object
|
function
|
<optional>
|
null
|
Value representing the context that exposes properties and functionality the passed value is parsed under. |
reject |
boolean
|
Array.<string>
|
<optional>
|
["eval", "Function", ".prototype.", ".constructor", "function", "=>"]
|
Value representing if functions are to be rejected or array of strings representing the values that cause a POJO string to be rejected. |
|
Returns:
Type |
Description |
Array.<object>
|
Value representing the POJO data. |
[mixin]
ish.type.obj.pojo.check(x, vRejectopt) → {Array.<object>}
- Source:
Determines if the passed value is a safe string representing a Plain Old Javascript Object (POJO).
From Mixin: ish.type.obj.pojo.js
must be included for ishJS
to access this functionality.
Note: This represents a "better than nothing" approach to checking the relative safety of the passed value. However, values should only be loaded from trusted sources.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
string
|
|
|
Value representing the POJO data to check. |
vReject |
boolean
|
Array.<string>
|
<optional>
|
["eval", "Function", ".prototype.", ".constructor", "function", "=>"]
|
Value representing if functions are to be rejected or array of strings representing the values that cause a POJO string to be rejected. |
Returns:
Type |
Description |
Array.<object>
|
Value representing if the POJO data is relatively safe. |