- Source:
Collection of Type-based functionality (is
and mk
only)
Methods
ish.type(x, a_vOrderopt) → {function}
- Source:
- To Do:
-
- Detail recognized a_vOrder values
Determines the type of the passed value.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
a_vOrder |
Array.<variant>
|
<optional>
|
ish.config.ish().typeOrder
|
Type ordering to use during interrogation. |
Returns:
Type |
Description |
function
|
Value indicating the type of the passed value. |
[mixin]
ish.type.any(x, a_vReferenceValues, bUseCoercionopt) → {boolean}
- Source:
Determines if the passed value is one of the reference values.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
x |
variant
|
|
|
Value to interrogate. |
a_vReferenceValues |
Array.<variant>
|
|
|
Value representing the reference values to compare to. |
bUseCoercion |
boolean
|
<optional>
|
false
|
Value representing if coercion is to be used during comparisons. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed value is present in the reference values. |
[mixin]
ish.type.query(vCollection, vQuery, oOptionsopt) → {Array.<variant>|variant}
- Source:
Queries the passed value.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Description |
vCollection |
Array.<variant>
|
object
|
|
Value representing the collection to interrogate. |
vQuery |
object
|
Array.<object>
|
|
Value representing the query. |
oOptions |
object
|
<optional>
|
Value representing the following options:
Properties
Name |
Type |
Attributes |
Default |
Description |
firstEntryOnly |
boolean
|
<optional>
|
false
|
Value representing if only the first result is to be returned. |
caseInsensitive |
boolean
|
<optional>
|
false
|
Value representing if the keys are to be searched for in a case-insensitive manor. |
useCoercion |
boolean
|
<optional>
|
false
|
Value representing if coercion is to be used during comparisons. |
useKeyValue |
boolean
|
<optional>
|
false
|
Value representing if the query is specified as a key/value. |
|
Returns:
Type |
Description |
Array.<variant>
|
variant
|
Value representing the passed values that matched the query. |
[mixin]
ish.type.register(sTypeName, vTest, vMkDefaultValopt) → {boolean}
- Source:
Registers a new type interface under ish.type
.
From Mixin: ish.type-ex.js
must be included for ishJS
to access this functionality.
Parameters:
Name |
Type |
Attributes |
Description |
sTypeName |
string
|
|
Value representing the type name to register.
This must be unique (e.g. not currently in use under ish.type ). |
vTest |
function
|
RegExp
|
|
Value representing the test that verifies the type as a RegExp expression or a function that implements the test, accepting 1 argument (x ) and returning truthy if the value is of a valid type. |
vMkDefaultVal |
variant
|
<optional>
|
Value representing the default value returned by the mk interface if a vDefaultVal is not provided in the call.
If this argument is omitted, a mk is not created. |
Returns:
Type |
Description |
boolean
|
Value representing if the new type interface was successfully registered under ish.type .
The ish.type[sTypeName] type interface is created with an is and optional mk functions. is accepts at least 1 argument which defines the variable to test. mk accepts 2 arguments (vValToTest , vDefraultVal ) while calling the is interface, passing in vValToTest to determine if it is a valid type. |