MCPcopy Index your code
hub / github.com/nodejs/node / range

Function range

deps/minimatch/index.js:30–64  ·  view source on GitHub ↗
(a, b, str)

Source from the content-addressed store, hash-verified

28 return m ? m[0] : null;
29 };
30 var range = (a, b, str) => {
31 let begs, beg, left, right = void 0, result;
32 let ai = str.indexOf(a);
33 let bi = str.indexOf(b, ai + 1);
34 let i = ai;
35 if (ai >= 0 && bi > 0) {
36 if (a === b) {
37 return [ai, bi];
38 }
39 begs = [];
40 left = str.length;
41 while (i >= 0 && !result) {
42 if (i === ai) {
43 begs.push(i);
44 ai = str.indexOf(a, i + 1);
45 } else if (begs.length === 1) {
46 const r = begs.pop();
47 if (r !== void 0)
48 result = [r, bi];
49 } else {
50 beg = begs.pop();
51 if (beg !== void 0 && beg < left) {
52 left = beg;
53 right = bi;
54 }
55 bi = str.indexOf(b, i + 1);
56 }
57 i = ai < bi && ai >= 0 ? ai : bi;
58 }
59 if (begs.length && right !== void 0) {
60 result = [left, right];
61 }
62 }
63 return result;
64 };
65 exports2.range = range;
66 }
67});

Callers 15

parseFunction · 0.50
is_subsetFunction · 0.50
mainFunction · 0.50
init_defaultsFunction · 0.50
GenRandomFunction · 0.50
EmitDataMethod · 0.50
RunAllFunction · 0.50
print_statsFunction · 0.50
prepareMethod · 0.50
collect_bucketsFunction · 0.50
mainFunction · 0.50

Calls 3

popMethod · 0.80
indexOfMethod · 0.45
pushMethod · 0.45

Tested by 15

GenRandomFunction · 0.40
EmitDataMethod · 0.40
RunAllFunction · 0.40
MainFunction · 0.40
GetVarsFunction · 0.40
setUpMethod · 0.40
setUpMethod · 0.40
test_init_infinityMethod · 0.40
test_init_0Method · 0.40
test_hash_boundariesMethod · 0.40
testNormalMethod · 0.40
testExceptionMethod · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…