MCPcopy Create free account
hub / github.com/dataease/SQLBot / _gen

Method _gen

frontend/public/swagger-ui-bundle.js:19156–19193  ·  view source on GitHub ↗
(s, o)

Source from the content-addressed store, hash-verified

19154 return this._gen(this.tokens, [])
19155 }
19156 _gen(s, o) {
19157 var i, a, u, w, x
19158 switch (s.type) {
19159 case _.ROOT:
19160 case _.GROUP:
19161 if (s.followedBy || s.notFollowedBy) return ''
19162 for (
19163 s.remember && void 0 === s.groupNumber && (s.groupNumber = o.push(null) - 1),
19164 a = '',
19165 w = 0,
19166 x = (i = s.options ? this._randSelect(s.options) : s.stack).length;
19167 w < x;
19168 w++
19169 )
19170 a += this._gen(i[w], o)
19171 return (s.remember && (o[s.groupNumber] = a), a)
19172 case _.POSITION:
19173 return ''
19174 case _.SET:
19175 var C = this._expand(s)
19176 return C.length ? String.fromCharCode(this._randSelect(C)) : ''
19177 case _.REPETITION:
19178 for (
19179 u = this.randInt(s.min, s.max === 1 / 0 ? s.min + this.max : s.max),
19180 a = '',
19181 w = 0;
19182 w < u;
19183 w++
19184 )
19185 a += this._gen(s.value, o)
19186 return a
19187 case _.REFERENCE:
19188 return o[s.value - 1] || ''
19189 case _.CHAR:
19190 var j = this.ignoreCase && this._randBool() ? this._toOtherCase(s.value) : s.value
19191 return String.fromCharCode(j)
19192 }
19193 }
19194 _toOtherCase(s) {
19195 return s + (97 <= s && s <= 122 ? -32 : 65 <= s && s <= 90 ? 32 : 0)
19196 }

Callers 1

genMethod · 0.95

Calls 6

_randSelectMethod · 0.95
_expandMethod · 0.95
randIntMethod · 0.95
_randBoolMethod · 0.95
_toOtherCaseMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected