JavaScript implementation of Lenses concept