MCPcopy Create free account
hub / github.com/Inviz/lsd / walk

Function walk

Source/Sheet.js:244–268  ·  view source on GitHub ↗
(k, l, m)

Source from the content-addressed store, hash-verified

242 }
243 } else { //dry run, get some more info
244 var walk = function(k, l, m) {
245 if (k < 0 || l < 0) return;
246 if (match.structure(hierarchy[k], selector[l])) {
247 if (m > -1) {
248 if (match.state(hierarchy[k], selector[l])) {
249 m--;
250 } else {
251 if (k == i) m = -2; //last element doesnt match the last part of selector, dont look for exact match anymore
252 }
253 }
254 if (m == -1) { //selector is fully matched
255 return true;
256 } else if (l == 0) { //last selector bit was structure-matched
257 return false;
258 } else { //dig deeper
259 return walk(k - 1, l - 1, m);
260 }
261 } else {
262 if (k == i) { //last hierarchy bit is not matched, skip selector
263 return;
264 } else { //try the same selector with another widget
265 return walk(k - 1, l, m);
266 }
267 }
268 }
269 switch (walk(i, j, j)) {
270 case undefined:
271 return;

Callers 2

Sheet.jsFile · 0.85
LayoutEvents.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected