import { FilterFn , commit , modify } from '@collectable/core' ; import { filter as _filter } from '@collectable/map' ; import { HashSetStructure } from '../internals' ; function filterMap < T > ( pred ) { return function ( value , key , index ) : boolean { return pred ( key , index ) ; } ; } export function filter < T > ( fn , set ) { set = modify ( set ) ; _filter ( filterMap ( fn ) , set . _map ) ; return commit ( set ) ; }