Methods
ITEMS(…key) → {DatumPlan_Tweak}
Compose a tweak making a specified slot in the spec an Array
- Source:
- Since:
- 2.1.0
This tweak-composer can be used to specify a slot within the original spec
as being an Array. This is often needed because the input POD data for the
spec contains two or more elements in the slot indicated by the passed keys,
which is not acceptable for datum plan generation. Calling this function
returns a tweak to set that slot to []
.
As with the other built-in tweak composers, the tweak function returned
from this function has a plan()
method, which creates the same tweak
except substitutes the item plan spec passed to plan()
as the single
element in the Array injected into the clone of the input spec, allowing
the generated Lens to pass the item plan to its IndexableMixin
methods.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
* |
<repeatable> |
A name or index to use in successive subscripting (i.e. square bracket) operations |
Returns:
A "tweak" function producing a cloned plan with the specified change
- Type
- DatumPlan_Tweak
NAMED_ENTRIES(…key) → {DatumPlan_Tweak}
Compose a tweak making a specified slot in the spec a dictionary-like collection
- Source:
- Since:
- 2.1.0
datumPlan.fromPOD()
has no way of determining that an Object in the spec
is an example of dictionary-like behavior, but this method can be used
to alter an initial POD spec to indicate the slot specified by keys is
to be treated as a dictionary.
As with the other built-in tweak composers, the tweak function returned
from this function has a plan()
method, which creates the same tweak
except substitutes the entry value spec passed to plan()
as the entry
value spec at the point specified in the spec by all the keys instead of
just substituting datumPlan.value
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
* |
<repeatable> |
A name or index to use in successive subscripting (i.e. square bracket) operations |
Returns:
A "tweak" function producing a cloned plan with the specified change
- Type
- DatumPlan_Tweak
NAMED_ENTRIES_ALSO(…key) → {DatumPlan_Tweak}
Compose a tweak marking the specified slot as supporting non-explicit keys
- Source:
- Since:
- 2.1.0
datumPlan.fromPOD()
has no way of determining that an Object in the spec
is an example of dictionary-like behavior, but this method can be used
to alter an initial POD spec to indicate the slot specified by keys is
expected to contain keys in addition to the ones in the spec.
As with the other built-in tweak composers, the tweak function returned
from this function has a plan()
method, which creates the same tweak
except substitutes the entry value spec passed to plan()
as the entry
value spec for all incidental keys at the point in the spec specified by
all the keys instead of just substituting datumPlan.value
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
* |
<repeatable> |
A name or index to use in successive subscripting (i.e. square bracket) operations |
Returns:
A "tweak" function producing a cloned plan with the specified change
- Type
- DatumPlan_Tweak
VALUE(…key) → {DatumPlan_Tweak}
Compose a tweak making a specified slot into a terminal value in the datum plan
- Source:
- Since:
- 2.1.0
Like using datumPlan.value in a standard plan, this tweak-composer specifies a point at some depth in the datum plan terminating the generation of deeper (i.e. more tightly focused) Lenses.
As with the other built-in tweak composers, the tweak function returned
from this function has a plan()
method, which creates the same tweak
except substitutes the value spec passed to plan()
at the point
specified in the spec by all the keys instead of just substituting
datumPlan.value
.
This particular method, with adjustments to keys and the value passed
to plan()
, can reproduce the effects of all the other methods.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
* |
<repeatable> |
A name or index to use in successive subscripting (i.e. square bracket) operations |
Returns:
A "tweak" function producing a cloned plan with the specified change
- Type
- DatumPlan_Tweak