Class: Dish

Dish


new Dish(value, type)

The data being operated on by each operation.

Parameters:
Name Type Description
value byte_array | string | number

The value of the input data.

type number

The data type of value, see Dish enums.

Author:
  • <p>n1474335 [n1474335@gmail.com]</p>
License:
  • Apache-2.0
Source:

Members


<static, readonly> BYTE_ARRAY

Dish data type enum for byte arrays.

Source:

<static, readonly> STRING

Dish data type enum for strings.

Source:

<static, readonly> NUMBER

Dish data type enum for numbers.

Source:

<static, readonly> HTML

Dish data type enum for HTML.

Source:

Methods


<static> type_enum(type_str)

Returns the data type enum for the given type string.

Parameters:
Name Type Description
type_str string

The name of the data type.

Source:
Returns:

The data type enum value.

Type
number

<static> enum_lookup(type_enum)

Returns the data type string for the given type enum.

Parameters:
Name Type Description
type_enum string

The enum value of the data type.

Source:
Returns:

The data type as a string.

Type
number

set(value, type)

Sets the data value and type and then validates them.

Parameters:
Name Type Description
value byte_array | string | number

The value of the input data.

type number

The data type of value, see Dish enums.

Source:

get(type)

Returns the value of the data in the type format specified.

Parameters:
Name Type Description
type number

The data type of value, see Dish enums.

Source:
Returns:

The value of the output data.

Type
byte_array | string | number

translate(to_type)

Translates the data to the given type format.

Parameters:
Name Type Description
to_type number

The data type of value, see Dish enums.

Source:

valid()

Validates that the value is the type that has been specified.
May have to disable parts of BYTE_ARRAY validation if it effects performance.

Source:
Returns:

Whether the data is valid or not.

Type
boolean