MCPcopy Create free account
hub / github.com/jshttp/cookie / valueSliceTwoWhileExitEarly

Function valueSliceTwoWhileExitEarly

benchmarks/value-slice.bench.ts:120–138  ·  view source on GitHub ↗
(str: string, min: number, max: number)

Source from the content-addressed store, hash-verified

118}
119
120function valueSliceTwoWhileExitEarly(str: string, min: number, max: number) {
121 if (min === max) return "";
122 let start = min;
123 let end = max;
124
125 while (start < end) {
126 const code = str.charCodeAt(start);
127 if (code !== 32 /* */ && code !== 9 /* \t */) break;
128 start++;
129 }
130
131 while (end > start) {
132 const code = str.charCodeAt(end - 1);
133 if (code !== 32 /* */ && code !== 9 /* \t */) break;
134 end--;
135 }
136
137 return str.slice(start, end);
138}
139
140function valueSliceTwoDoWhile(str: string, min: number, max: number) {
141 let start = min;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…