function getOrientation(matchMedia) {
    // if there's no window
    if (typeof matchMedia === 'undefined') {
        // return the default
        return defaultOrientation
    }

    const mediaQueries = {
        portrait: '(orientation: portrait)',
        landscape: '(orientation: landscape)',
    }

    // there is a window, so compute the true orientation
    return Object.keys(mediaQueries).reduce((result, query) => {
        // return the new type if the query matches otherwise the previous one
        return matchMedia(mediaQueries[query]).matches ? query : result
        // use the default orientation
    }, defaultOrientation)
}
Gets the current media type from the global `window`.
@arg {object} mediaQueries - The media queries object.
@returns {string} The window's current media type.  This is the key of the
breakpoint that is the next breakpoint larger than the window.