import * as uriJs from 'uri-js' ; param uri param rootPath return export function getPathFromUri ( uri , rootPath ) { if ( ! uri || ! rootPath ) { return '' ; } const lUri = decodeURIComponent ( uri ) ; const parsedUri = uriJs . parse ( lUri ) ; if ( ! parsedUri . path ) { return '' ; } let matches ; const lRootPath = rootPath . replace ( /\\/g , '/' ) ; const regex = new RegExp ( `/?${ lRootPath }(.*)` ) ; if ( ( matches = regex . exec ( parsedUri . path ) ) != null && matches . length > 1 ) { return lRootPath + matches [ 1 ] ; } return '' ; }