@ -37,19 +37,6 @@ export function stripTags(text) {
return text . replace ( /<[^>]*>?/g , '' ) ;
return text . replace ( /<[^>]*>?/g , '' ) ;
}
}
// searches the inclusive range [minValue, maxValue].
// credits: https://matthiasott.com/notes/write-your-media-queries-in-pixels-not-ems
export function mqBinarySearch ( feature , minValue , maxValue , step , unit ) {
if ( maxValue - minValue < step ) {
return minValue ;
}
const mid = Math . ceil ( ( minValue + maxValue ) / 2 / step ) * step ;
if ( matchMedia ( ` screen and (min- ${ feature } : ${ mid } ${ unit } ) ` ) . matches ) {
return mqBinarySearch ( feature , mid , maxValue , step , unit ) ; // feature is >= mid
}
return mqBinarySearch ( feature , minValue , mid - step , step , unit ) ; // feature is < mid
}
export function parseIssueHref ( href ) {
export function parseIssueHref ( href ) {
const path = ( href || '' ) . replace ( /[#?].*$/ , '' ) ;
const path = ( href || '' ) . replace ( /[#?].*$/ , '' ) ;
const [ _ , owner , repo , type , index ] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/ . exec ( path ) || [ ] ;
const [ _ , owner , repo , type , index ] = /([^/]+)\/([^/]+)\/(issues|pulls)\/([0-9]+)/ . exec ( path ) || [ ] ;