Global

Methods

(async) flatten(jsonString) → {string}

Removes single-key objects from a JSON object and returns their values.
Parameters:
Name Type Description
jsonString string The JSON string to be transformed.
Source:
Returns:
The transformed JSON string without single-key objects.
Type
string

(async) graphOnly(jsonObject) → {Promise.<Object>}

Extracts the "@graph" property from a JSON object.
Parameters:
Name Type Description
jsonObject Object The JSON object.
Source:
Returns:
A Promise that resolves to the "@graph" property value.
Type
Promise.<Object>

(async) listFiles(owner, repo, pathopt, branch) → {Promise.<Array.<Object>>}

Fetches a list of files from a GitHub repository.
Parameters:
Name Type Attributes Default Description
owner string The GitHub owner or organization.
repo string The repository name.
path string <optional>
'' The path within the repository (optional).
branch string The branch name.
Source:
Returns:
A Promise that resolves to an array of file objects.
Type
Promise.<Array.<Object>>

(async) printState(jsonObject) → {Object}

Print the current state without breaking the chain
Parameters:
Name Type Description
jsonObject Object The JSON string to be transformed.
Source:
Returns:
The transformed JSON string without single-key objects.
Type
Object

(async) readFileFS(filename) → {Promise.<(Object|null)>}

Reads a JSON file from the file system.
Parameters:
Name Type Description
filename string The name of the file to read.
Source:
Returns:
A Promise that resolves to the parsed JSON object or null if an error occurs.
Type
Promise.<(Object|null)>

(async) readFileGH(owner, repo, filePath, branch) → {Promise.<string>}

Reads the content of a file from a GitHub repository.
Parameters:
Name Type Description
owner string The GitHub owner or organization.
repo string The repository name.
filePath string The path to the file within the repository.
branch string The branch name.
Source:
Returns:
A Promise that resolves to the file content as a string.
Type
Promise.<string>

(async) rmld(jsonString) → {string}

Removes all "@" entries from a JSON object.
Parameters:
Name Type Description
jsonString string The JSON string to be transformed.
Source:
Returns:
The transformed JSON string without "@" entries.
Type
string

(async) rmnull(jsonString) → {string}

Removes all "null" valued entries from a JSON object.
Parameters:
Name Type Description
jsonString string The JSON string to be transformed.
Source:
Returns:
The transformed JSON string without "@" entries.
Type
string

(async) str2JSON(jsonString) → {Object}

Parses a JSON string and returns the corresponding JavaScript object.
Parameters:
Name Type Description
jsonString string The JSON string to be parsed.
Source:
Returns:
The parsed JavaScript object.
Type
Object

(async) stringify(jsonObject) → {string}

Converts a JSON object to a string.
Parameters:
Name Type Description
jsonObject Object The JSON object to be stringified.
Source:
Returns:
The stringified JSON object.
Type
string

(async) untag(jsonString) → {string}

Removes all JSON-LD prefixes from keys in a JSON object.
Parameters:
Name Type Description
jsonString string The JSON string to be transformed.
Source:
Returns:
The transformed JSON string without JSON-LD prefixes.
Type
string

writeFile(content, file)

Writes the content of a JSON object to a file.
Parameters:
Name Type Description
content Object The JSON object to be written to the file.
file string The name of the file to write to.
Source: