export function omit < T extends object , K extends keyof T > ( target , ... omitKeys ) { return ( Object . keys ( target ) as K [ ] ) . reduce ( ( res , key ) => { if ( ! omitKeys . includes ( key ) ) { res [ key ] = target [ key ] ; } return res ; } , { } as any ) ; } export function filterObject ( o , recommendations , search ) { let filtered = { } ; if ( recommendations . length ) { Object . entries ( o ) . forEach ( kv => { const [ key , value ] = kv ; if ( recommendations . includes ( key ) ) { filtered [ key ] = value ; } } ) ; } else { if ( search . length === 0 ) { filtered = { ... o } ; } else { return { } ; } } return filtered ; } export function applyMixins ( derivedCtor , baseCtors ) { baseCtors . forEach ( baseCtor => { Object . getOwnPropertyNames ( baseCtor . prototype ) . forEach ( name => { Object . defineProperty ( derivedCtor . prototype , name , Object . getOwnPropertyDescriptor ( baseCtor . prototype , name ) ) ; } ) ; } ) ; }