Urara-Blog/node_modules/.pnpm-store/v3/files/32/71c023a86e231ea053c9dcdd5e7ad4e7f351a830387e48e2d747680ba1109c70f9eb4dec4908208e0b28061bb7f257842641c13855a0e260123f7b8f4cd7c4
2022-08-14 01:14:53 +08:00

25 lines
649 B
Text

import SOURCEMAPPING_URL from './sourceMappingURL.js';
export default function getSourceMappingUrl ( str ) {
var index, substring, url, match;
// assume we want the last occurence
index = str.lastIndexOf( `${SOURCEMAPPING_URL}=` );
if ( index === -1 ) {
return null;
}
substring = str.substring( index + 17 );
match = /^[^\r\n]+/.exec( substring );
url = match ? match[0] : null;
// possibly a better way to do this, but we don't want to exclude whitespace
// from the sourceMappingURL because it might not have been correctly encoded
if ( url && url.slice( -2 ) === '*/' ) {
url = url.slice( 0, -2 ).trim();
}
return url;
}