ish.type.enum

Enumerations mixin for ish.js

Source:
Author:
  • Nick Campbell
License:
  • MIT

Methods

[mixin] ish.type.enum(sEnum, bAsObjopt) → {Array.<object>|object}

Source:
Determines the enumeration data for the passed value.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
sEnum string Value representing the enumeration to interrogate.
bAsObj boolean <optional>
false Value representing if the return value is to be represented by a simplified { label: value }-based object.
Returns:
Type Description
Array.<object> | object Value representing the enumeration data.

[mixin] ish.type.enum.decode(sEnum, vValue, vOptionsopt) → {string|object}

Source:
Decodes the passed value as an enumeration.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Description
sEnum string Value representing the enumeration to interrogate.
vValue variant Value to interrogate within the passed enumeration representing a value.
vOptions boolean | object <optional>
Value representing if the full enumeration entry is to be returned or the desired options:
Properties
Name Type Attributes Default Description
asEntry boolean <optional>
false Value representing if the full enumeration entry is to be returned.
compare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparison.
Returns:
Type Description
string | object Value representing the passed value as an enumeration.

[mixin] ish.type.enum.encode(sEnum, sLabel, vOptionsopt) → {variant|object}

Source:
Encodes the passed value as an enumeration.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Description
sEnum string Value representing the enumeration to interrogate.
sLabel string Value to interrogate within the passed enumeration representing a label.
vOptions boolean | object <optional>
Value representing if the full enumeration entry is to be returned or the desired options:
Properties
Name Type Attributes Default Description
asEntry boolean <optional>
false Value representing if the full enumeration entry is to be returned.
compare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparison.
Returns:
Type Description
variant | object Value representing the passed value as an enumeration.

[mixin] ish.type.enum.exists(sEnum) → {boolean}

Source:
Determines if the passed value represents an enumeration.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Description
sEnum string Value representing the enumeration to interrogate.
Returns:
Type Description
boolean Value representing if the passed value represents an enumeration.

[mixin] ish.type.enum.interface() → {object}

Source:
Returns a new instance of the base interface for an enumeration.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Returns:
Type Description
object Value representing the base interface for an enumeration.

[mixin] ish.type.enum.is(sEnum, vValue, vCompareopt) → {boolean}

Source:
Determines if the passed value represents a label or value within the passed enumeration entry.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
sEnum string Value representing the enumeration to interrogate.
vValue variant Value to interrogate within the passed enumeration representing a label or value.
vCompare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparisons.
Returns:
Type Description
boolean Value representing if the passed value represents a label or value within the passed enumeration entry.

[mixin] ish.type.enum.is.label(sEnum, sValue, vCompareopt) → {boolean}

Source:
Determines if the passed value represents a label within the passed enumeration entry.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
sEnum string Value representing the enumeration to interrogate.
sValue string Value to interrogate within the passed enumeration representing a label.
vCompare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparisons.
Returns:
Type Description
boolean Value representing if the passed value represents a label within the passed enumeration entry.

[mixin] ish.type.enum.is.value(sEnum, vValue, vCompareopt) → {boolean}

Source:
Determines if the passed value represents a value within the passed enumeration entry.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Default Description
sEnum string Value representing the enumeration to interrogate.
vValue variant Value to interrogate within the passed enumeration representing a value.
vCompare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparisons.
Returns:
Type Description
boolean Value representing if the passed value represents a value within the passed enumeration entry.

[mixin] ish.type.enum.load(vEnums) → {boolean}

Source:
Loads the passed value as enumeration(s) into the existing collection.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Note: If vEnums represents a URL, the ish.io.net Mixin is required in order to collect the JSON file.
Parameters:
Name Type Description
vEnums string | object Value representing the URL to a JSON file or an object defining enumeration(s).
Returns:
Type Description
boolean Value representing if the passed value was successfully loaded.

[mixin] ish.type.enum.mk(sEnum, vValue, vOptionsopt) → {variant|object}

Source:
Casts the passed value into an enumeration.
From Mixin: ish.type.enum.js must be included for ishJS to access this functionality.
Parameters:
Name Type Attributes Description
sEnum string Value representing the enumeration to interrogate.
vValue variant Value to interrogate within the passed enumeration representing a value.
vOptions boolean | object <optional>
Value representing if the full enumeration entry is to be returned or the desired options:
Properties
Name Type Attributes Default Description
asEntry boolean <optional>
false Value representing if the full enumeration entry is to be returned.
compare boolean | function <optional>
function (x, y) { return (x == y); } Value representing if the comparison is to be case-insensitive or the function to execute the comparison.
Returns:
Type Description
variant | object Value representing the passed value as an enumeration.