Namespace: Utils

Utils

Namespaces

JSON
Request
Response

Methods


<static> generateId()

Generates a random UUID
Source:
Returns:
Type
String

<static> parseBody(stream [, reviver], callback)

Helper to parse a stream and interpret it as JSON
Parameters:
Name Type Argument Description
stream Stream Stream instance
reviver function <optional>
Optional reviver for JSON.parse
callback function
Source:

<static> parseStream(stream, options, onRequest)

Parses an incoming stream for requests using JSONStream
Parameters:
Name Type Description
stream Stream
options Object
onRequest function Called once for stream errors and an unlimited amount of times for valid requests
Source:

<static> response(error, result, id, version)

Generates a JSON-RPC 1.0 or 2.0 response
Parameters:
Name Type Description
error Object Error member
result Object Result member
id String | Number | null Id of request
version Number JSON-RPC version to use
Source:
Returns:
A JSON-RPC 1.0 or 2.0 response
Type
Object

<static> walk(holder, key, fn)

Recursively walk an object and apply a function on its members
Parameters:
Name Type Description
holder Object The object to walk
key String The key to look at
fn function The function to apply to members
Source:
Returns:
Type
Object