MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / addRule

Method addRule

hyperagent-ext/media/scripts/highlight.min.js:128–130  ·  view source on GitHub ↗
(e,n)

Source from the content-addressed store, hash-verified

126 }class t{constructor(){
127 this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}
128 addRule(e,n){
129 n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]),
130 this.matchAt+=_(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null)
131 ;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(f(e,{joinWith:"|"
132 }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex
133 ;const n=this.matcherRe.exec(e);if(!n)return null

Callers 1

getMatcherMethod · 0.95

Calls 2

pushMethod · 0.80
_Function · 0.70

Tested by

no test coverage detected