Constructor
new JSON_ADAPTER(optionsopt)
Parameters:
Name | Type | Attributes | Default | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Configurable options for the adapter Properties
|
- Source:
Methods
error(err, options, cbopt) → {*}
Creates a formatted error response
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
err |
* | Any data to be sent as part of error response |
||||||||||||||||||||||
options |
Object | Configurable options for error response formatting see _ERROR for more details Properties
|
||||||||||||||||||||||
cb |
function |
<optional> |
false | An optional callback function. If this argument is not a function it will be ignored |
- Source:
Returns:
Returns the formatted json object if options.sync is true or a Promise if cb arugement is not passed
- Type
- *
render(data, optionsopt, cbopt) → {*}
Creates a formatted response
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data |
* | Any data that should be sent with the success response |
||||||||||||||||||||||
options |
Object |
<optional> |
{} | Configurable options for success response formatting see _RENDER for more details Properties
|
||||||||||||||||||||
cb |
function |
<optional> |
false | An optional callback function. If this argument is not a function it will be ignored |
- Source:
Returns:
Returns the formatted json object if options.sync is true or a Promise if cb arugement is not passed
- Type
- *