Class: Utility

bo.system. Utility

Provides static methods for configuration and internationalization.

new Utility()

Creates a new utility object.

Methods

<static> getDirectory(relativePath, name, errorType) → {string}

Gets the full path of a directory.

Parameters:
Name Type Description
relativePath string

The relative path of the directory.

name string

The name of the configuration item.

errorType error

The type of the error to throw in case of failure.

Throws:
  • Configuration I18n error: The property value of business objects' configuration must be a string.
  • Configuration I18n error: The property value of business objects' configuration is not a valid directory path.
Returns:

The full path of a directory.

Type
string

<static> getFunction(relativePath, name, errorType) → {function}

Gets a function read from a file.

Parameters:
Name Type Description
relativePath string

The relative path of the file to read.

name string

The name of the configuration item.

errorType error

The type of the error to throw in case of failure.

Throws:
  • Configuration I18n error: The property value of business objects' configuration must be a string.
  • Configuration I18n error: The property value of business objects' configuration is not a valid file path.
  • Configuration I18n error: The file defined by the property of business objects' configuration must return a function.
Returns:

The required function.

Type
function

<static> isEnumMember(value, enumType, name, errorType) → {number}

Checks if value is member of a given enumeration.

Parameters:
Name Type Description
value number | string

The value to check.

enumType constructor

The type of the enumeration.

name string

The name of the configuration item.

errorType error

The type of the error to throw in case of failure.

Throws:
Returns:

The checked value.

Type
number

<static> isMandatoryString(value, name, errorType) → {string}

Checks if value is a non-empty string.

Parameters:
Name Type Argument Description
value string <optional>

The value to check.

name string

The name of the parameter.

errorType error

The type of the error to throw in case of failure.

Throws:
I18n error: The argument must be a non-empty string.
Returns:

The checked value.

Type
string

<static> isOptionalString(value, name, errorType) → {string|null}

Checks if value is a string or null.

Parameters:
Name Type Argument Default Description
value string | null <optional>
null

The value to check.

name string

The name of the parameter.

errorType error

The type of the error to throw in case of failure.

Throws:
I18n error: The value must be a string value or null.
Returns:

The checked value.

Type
string | null
If you find bugs or have feature requests, please let us know.

JavaScript business objects ♦ Copyright © 2014-2016 Logikum, Ltd.
Documentation generated by JSDoc 3.2.2 on 2015. December 31. using the DocStrap template.