MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / getSourceURL

Function getSourceURL

ses.cjs:5658–5689  ·  view source on GitHub ↗
(src)

Source from the content-addressed store, hash-verified

5656 * @param {string} src
5657 */
5658const getSourceURL= (src)=>{
5659 let sourceURL= '<unknown>';
5660
5661 // Our regular expression matches the last one or two comments with key value
5662 // pairs at the end of the source, avoiding a scan over the entire length of
5663 // the string, but at the expense of being able to capture all the (key,
5664 // value) pair meta comments at the end of the source, which may include
5665 // sourceMapURL in addition to sourceURL.
5666 // So, we sublimate the comments out of the source until no source or no
5667 // comments remain.
5668 while( src.length> 0) {
5669 const match= regexpExec(sourceMetaEntriesRegExp, src);
5670 if( match=== null) {
5671 break;
5672 }
5673 src= stringSlice(src, 0, src.length- match[0].length);
5674
5675 // We skip $0 since it contains the entire match.
5676 // The match contains four capture groups,
5677 // two (key, value) pairs, the first of which
5678 // may be undefined.
5679 // On the off-chance someone put two sourceURL comments in their code with
5680 // different commenting conventions, the latter has precedence.
5681 if( match[3]=== 'sourceURL') {
5682 sourceURL= match[4];
5683 }else if( match[1]=== 'sourceURL') {
5684 sourceURL= match[2];
5685 }
5686 }
5687
5688 return sourceURL;
5689 };$h‍_once.getSourceURL(getSourceURL);
5690})()
5691,
5692// === functors[27] ===

Callers 3

rejectHtmlCommentsFunction · 0.85
rejectImportExpressionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected