export function create < T > ( collection , selector ) { const result = { } ; collection . forEach ( ( value ) => { result [ selector ( value ) ] = value ; } ) ; return result ; } export function set < K extends keyof any , T > ( record , key , item ) { return { ... record , [ key ] : item } ; } export function remove < T > ( record , key ) { const { [ key ] : value , ... removed } = record ; return removed ; } export function removeS < T > ( record , key ) { const { [ key ] : value , ... removed } = record ; return removed ; } export function values < T > ( record ) { return Object . keys ( record ) . map ( key => record [ parseInt ( key , 10 ) ] ) ; } export function map < T > ( record , mapper ) { return Object . keys ( record ) . reduce ( ( value , key ) => { value [ key ] = mapper ( record [ key ] ) ; return value ; } , { } ) ; }