new Factory(spec)
A factory for Lens-derived objects with customized container construction
- Source:
- Mixes In:
When POD container types (Object and Array) are not the desired types to construct in a clone -- as with use of immutable containers -- this class can be used to build lenses that do build the desired types of objects.
This class is often used in conjunction with a JsContainerFactory object implementing the container factory.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
spec |
Object |
Properties
|
Methods
A(…args) → {Lens}
- Source:
- Since:
- 2.3.0
- See:
This method is only available if module:natural-lenses/sugar-factory has been imported/required.
The BinderMixin#$ method may be helpful:
const A = new Factory({...}).$`A`;
Why A
?
A
is intended to represent "access", and the letter "LATIN CAPITAL LETTER A"
(U+0041) is often rendered to look a bit like light rays focusing through a lens.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
String template tag arguments |
Returns:
A lens with customized container construction behavior
- Type
- Lens
lens(…key) → {Lens}
Construct a lens through the factory
- Source:
- See:
This method works the same way as the main Lens constructor of module:natural-lenses, except that missing container construction is managed via the ContainerFactory with which this Factory was constructed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
* |
<repeatable> |
A key of the customized lens type |
Returns:
A lens with customized container creation behavior
- Type
- Lens