import { pipe } from '../pipe' ; import { View } from '../types/types' ; import { addToSet } from './addToSet' ; import { deleteFromSet } from './deleteFromSet' ; /**
 * A lens for zooming in on an element's presense in the set.
 */ export const setProp = < S , Value > ( value ) => ( { get , set , } ) : View < S , boolean > => ( { get : ( ) => get ( ) . has ( value ) , set : ( present ) => set ( pipe ( get ( ) , present ? addToSet ( value ) : deleteFromSet ( value ) ) as Set < Value > ) , } ) ;