import merge = require ( 'lodash/merge' ) ; import * as url from 'url' ; export * from './appendThriftObject' ; export * from './readThriftObject' ; export * from './readThriftMetadata' ; export * from './normalizePath' ; export function deepMerge < Base extends object , Update extends object > ( base , update ) { return merge ( { } , base , update ) ; } export function overlayObjects < A , B > ( a , b ) ; export function overlayObjects < A , B , C > ( a , b , c ) ; export function overlayObjects < A , B , C , D > ( a , b , c , d ) ; export function overlayObjects < A , B , C , D , E > ( a , b , c , d , e ) ; export function overlayObjects ( ... objs ) { return objs . reduce ( ( acc , next ) => { return deepMerge ( acc , next ) ; } , { } ) ; } export function formatUrl ( requestUrl ) { const parsed = url . parse ( url . format ( requestUrl ) ) ; if ( ! parsed . pathname ) { return `${ parsed . hostname || '' }/` ; } else { return `${ parsed . hostname || '' }${ parsed . pathname }` ; } }