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
          
   
Fields inherited from class Lens
name
 
Constructor Summary
LHoist(<String> prop, <boolean> check_prop)
           
 
Method Summary
 Object get(c)
          
 Object putback(a, c)
          
 
Methods inherited from class Lens
error, getput, putget, putput, get_is, putback_is, get_throws, putback_throws
 

Field Detail

name

Object name

Constructor Detail

LHoist

LHoist(<String> prop, <boolean> check_prop)

Method Detail

get

Object get(c)

putback

Object putback(a, c)


Documentation generated by JSDoc on Wed Feb 14 15:36:01 2007