function valuesOfObj < T > ( record ) { if ( 'values' in Object ) { return Object . values ( record ) ; } const values = [ ] ; for ( const key in record ) { if ( record . hasOwnProperty ( key ) ) { values . push ( record [ key ] ) ; } } return values ; } export function find < T > ( record , predicate ) { const values = valuesOfObj ( record ) ; if ( 'find' in values ) { return values . find ( predicate ) ; } const valuesNotNever = values as T [ ] ; for ( let i = 0 ; i < valuesNotNever . length ; i ++ ) { const value = valuesNotNever [ i ] ; if ( predicate ( value ) ) { return value ; } } return undefined ; } export function forEach < T > ( record , run ) { Object . entries ( record ) . forEach ( ( [ key , value ] ) => run ( value , key ) ) ; } export function includes < T > ( arr , value ) { return arr . indexOf ( value ) !== - 1 ; } export function findArr < T > ( record , predicate ) { for ( let i = 0 ; i < record . length ; i ++ ) { const value = record [ i ] ; if ( predicate ( value ) ) { return value ; } } return undefined ; }