1// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/index.js 2 3import t,{isTimeoutError as e}from"function-timeout";import r from"time-span";import o from"clone-regexp";const resultToMatch=t=>({match:t[0],index:t.index,groups:t.slice(1),namedGroups:t.groups??{},input:t.input});function isMatch(r,i,{timeout:n}={}){try{return t((()=>o(r).test(i)),{timeout:n})()}catch(t){if(e(t))return false;throw t}}function firstMatch(r,i,{timeout:n}={}){try{const e=t((()=>o(r).exec(i)),{timeout:n})();if(null===e)return;return resultToMatch(e)}catch(t){if(e(t))return;throw t}}function matches(o,i,{timeout:n=Number.POSITIVE_INFINITY,matchTimeout:u=Number.POSITIVE_INFINITY}={}){if(!o.global)throw new Error("The regex must have the global flag, otherwise, use `firstMatch()` instead");return{*[Symbol.iterator](){try{const e=i.matchAll(o);while(true){const o=t((()=>e.next()),{timeout:n!==Number.POSITIVE_INFINITY||u!==Number.POSITIVE_INFINITY?Math.min(n,u):void 0});const i=r();const{value:c,done:m}=o();n-=Math.ceil(i());if(m)break;yield resultToMatch(c)}}catch(t){if(!e(t))throw t}}}}export{firstMatch,isMatch,matches}; 4
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.