function pick < O extends object , K extends keyof O > ( object , keys ) { const result = { } ; for ( const key of keys ) { if ( Object . prototype . hasOwnProperty . call ( object , key ) ) { result [ key ] = object [ key ] ; } } return result ; } function getKeys < O extends object , K extends keyof O > ( object , keys ) { return ( Object . keys ( object ) as K [ ] ) . filter ( k => keys . includes ( k ) ) ; } function sortObjectComparator ( key , order ) { return ( a , b ) => { if ( a [ key ] < b [ key ] ) { return order === 'asc' ? - 1 : 1 ; } if ( a [ key ] > b [ key ] ) { return order === 'asc' ? 1 : - 1 ; } return 0 ; } ; } export { pick , getKeys , sortObjectComparator } ;