Schema

Schema

Validates Objects with zod schemas and formats validation error(s) for log output.

Constructor

new Schema(settings, schema)

Initializes a Schema class with custom Object settings

Source:
Parameters:
Name Type Description
settings Object

Custom Object containing key-value pairs

schema Object

zod Schema

Members

(private) data :Object|null

Settings object.

Source:
Type:
  • Object | null

Methods

formatErrorLog(errors) → {boolean}

Formats error messages into a single string

Source:
Parameters:
Name Type Description
errors Array.<Object>

List of zod error messages

Returns:
Type:
boolean

get() → {Object}

Returns the validated settings Object

Source:
Returns:
Type:
Object

Validated settings Object

validate(settings)

Validates a settings Object

Source:
Parameters:
Name Type Description
settings Object

JSON-like Object

Throws:

validation errors

Type
Error