Class LHoist
Object
|
+--Lens
|
+--LHoist
- class
LHoist
- extends Lens
A primitive lens for working with objects; it will 'hoist' a property
of a single property object, e.g.:
> h = new LHoist('foo')
> h.get({foo : 5})
5
> h.putback(5, _) // _ is anything
{ 'foo': 5 }
By Pierce and Foster's definition, hoist should only accept objects with a
single property. For convenience, more objects with more than one property
will be accepted by hoist; however, missing values will not be returned on
putback. If missing values should be restored on putback, use LFocus.
Hoist will also (non-standardly) accept objects on get without the desired
property; undefined will be returned.
See:Defined in lens.js
|
Field Summary |
Object |
name
|
|
Constructor Summary |
LHoist(<String> prop, <boolean> check_prop)
|
name
Object name
LHoist
LHoist(<String> prop, <boolean> check_prop)
Parameters:
prop - The property of the concrete tree to select for. It must have only one property. For a more permissive form of hoisting, see LFocus.
check_prop - Whether or not to check that the property prop is really present and the only property. If it is not, an error will be signalled. This is false by default.
get
Object get(c)
putback
Object putback(a, c)
Documentation generated by
JSDoc on Wed Feb 14 15:36:01 2007