Defines SlotCursor
(not exposed on baja
namespace).
new (require("baja/comp/SlotCursor"))()
A Cursor
used for Slot
iteration.
Extends:
Methods
-
actions()
-
Adds a filter to the Cursor for Actions.
Returns:
itself.
-
dynamic()
-
Adds a filter to the Cursor for dynamic Slots.
Returns:
itself.
-
each(func)
-
Iterate through the Cursor and call a function on every item.
When the function is called,
this
refers to thecontext
that
was passed in when the Cursor was created.Parameters:
Name Type Description func
function function called on every iteration with the 'value' being used as an argument.
If this is a Slot Cursor the 'value' will be a Slot.- Inherited From:
-
eachDisplay(func)
-
Iterate through the Cursor and call 'each' on every
Property
Slot and
get its displayString
.When the function is called, 'this' refers to the associated Complex and the argument
is the display String.Parameters:
Name Type Description func
function function called on every iteration with the argument being a Property's display String
-
eachValue(func)
-
Iterate through the Cursor and call 'each' on every
Property
Slot and
get its value.When the function is called, 'this' refers to the associated
Complex
and the argument is the value of theProperty
.Parameters:
Name Type Description func
function function called on every iteration with the
argument being aProperty
's value. -
equalType(typeSpec)
-
Adds a filter for Properties whose Type matches via equals.
This method can take a variable number of TypeSpecs. If a variable number
of TypeSpecs are specified then a slot will be filtered through if any of
the TypeSpecs match (logical OR).Parameters:
Name Type Description typeSpec
Type | String | Array the TypeSpec to test against.
Returns:
itself.
-
equalValue(value)
-
Adds a filter for Property values that match via equals.
This method can take a variable number of values. If a variable number
of values are specified then a slot will be filtered through if any of
the values match (logical OR).Parameters:
Name Type Description value
the value to be used for equals.
Returns:
itself.
-
equivalent(value)
-
Adds a filter for Property values that match via equivalent.
This method can take a variable number of values. If a variable number of
values are specified then a slot will be filtered through if any of the
values match (logical OR).Parameters:
Name Type Description value
the value to be used for equivalent.
Returns:
itself.
-
filter(filter)
-
Add a filter function to the Cursor.
Parameters:
Name Type Description filter
function used to filter the results of the Cursor.
When invoked, the first argument will be the item to filter (i.e. a Slot).
This function must return a true value for the item to be kept.- Inherited From:
Returns:
itself.
- Type
- baja.FilterCursor
-
first()
-
Return the first item in the cursor (regardless of iterative state).
If this is being used as a Slot Cursor, the Slot will be returned.
- Inherited From:
Returns:
first item found in the Cursor (or null if nothing found).
-
firstDisplay()
-
Return the first
Property
display String in the cursor (regardless of iterative state).Returns:
first
Property
display String found in the Cursor (or null if nothing found).- Type
- String
-
firstValue()
-
Return the first
Property
value in the cursor (regardless of iterative state).Returns:
first
Property
value found in the Cursor (or null if nothing found).- Type
- baja.Value
-
flags(flags)
-
Adds a filter for Slots that match the requested Slot Flags.
Parameters:
Name Type Description flags
Number the Slot flags to be tested for.
- See:
Returns:
itself.
-
frozen()
-
Adds a filter to the Cursor for frozen Slots.
Returns:
itself.
-
get()
-
Return the current item. If this is a
SlotCursor, this will return a
Slot.- Inherited From:
Returns:
the cursor value (null if none available).
-
getDisplay()
-
If the
Slot
is aProperty
, return its displayString
(otherwise return null).Returns:
display String.
- Type
- String
-
getSize()
-
Return the size of the cursor (regardless of iterative state).
- Inherited From:
Returns:
- Type
- Number
-
getValue()
-
If the
Slot
is aProperty
, return its value (otherwise return null).Returns:
a Property value.
-
is(typeSpec)
-
Adds a filter for Property values that match the TypeSpec via Type#is.
This method can take a variable number of TypeSpecs. If a variable
number of TypeSpecs are specified then a slot will be filtered through
if any of the TypeSpecs match (logical OR).Parameters:
Name Type Description typeSpec
Type | String the TypeSpec to test against.
- See:
Returns:
itself.
-
isComplex()
-
Adds a filter for Property values that are of Type
baja:Complex
(Type#isComplex).- See:
Returns:
itself.
-
isComponent()
-
Adds a filter for Property values that are of Type
baja:Component
(Type#isComponent).- See:
Returns:
itself.
-
isEmpty()
-
Return true if the Cursor is completely empty (regardless of iterative state).
- Inherited From:
Returns:
- Type
- Boolean
-
isNumber()
-
Adds a filter for Property values that are of Type
baja:Number
(Type#isNumber).- See:
Returns:
itself.
-
isSimple()
-
Adds a filter for Property values that are of Type
baja:Simple
(Type#isSimple).- See:
Returns:
itself.
-
isStruct()
-
Adds a filter for Property values that are of Type
baja:Struct
(Type#isStruct).- See:
Returns:
itself.
-
isValue()
-
Adds a filter for Property values that are of Type
baja:Value
(Type#isValue).- See:
Returns:
itself.
-
last()
-
Return the last item in the cursor (regardless of iterative state).
If this is being used as a Slot Cursor, the Slot will be returned.
- Inherited From:
Returns:
last item found in the Cursor (or null if nothing found).
-
lastDisplay()
-
Return the last
Property
displayString
in the cursor (regardless of iterative state).Returns:
last
Property
displayString
found in the Cursor (or null if nothing found).- Type
- String
-
lastValue()
-
Return the last
Property
value in the cursor (regardless of iterative state).Returns:
first Property value found in the Cursor (or null if nothing found).
- Type
- baja.Value
-
next()
-
Advance cursor and return true if successful.
- Inherited From:
Returns:
- Type
- Boolean
-
properties()
-
Adds a filter to the Cursor for Properties.
Returns:
itself.
-
slotName(slotName)
-
Adds a filter for Slots that match the given Slot name.
Parameters:
Name Type Description slotName
String | RegExp a String or Regular Expression for
matching Slots via name.Returns:
itself.
-
toArray()
-
Return an array of the cursor results (regardless of iterative state).
If this is a Slot Cursor, this will be an array of Slots.- Inherited From:
Returns:
- Type
- Array
-
toDisplayArray()
-
Return an array of
Property
displayString
s (regardless of iterative state).Returns:
- Type
- Array.<String>
-
toDisplayMap()
-
Return an Object Map of
Property
names with their corresponding displayString
s (regardless of iterative state).Returns:
- Type
- Object
-
toMap()
-
Return an Object Map of keys with their corresponding values.
If this is a Slot Cursor, this will be a Map of Slot names with their
corresponding Slots (regardless of iterative state).- Inherited From:
Returns:
- Type
- Object
-
topics()
-
Adds a filter to the Cursor for Topics.
Returns:
itself.
-
toValueArray()
-
Return an array of
Property
values (regardless of iterative state).Returns:
- Type
- Array.<baja.Value>
-
toValueMap()
-
Return an Object Map of
Property
names with their corresponding
values (regardless of iterative state).Returns:
- Type
- Object