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

Function valueSliceTwoWhile

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

Source from the content-addressed store, hash-verified

99}
100
101function valueSliceTwoWhile(str: string, min: number, max: number) {
102 let start = min;
103 let end = max;
104
105 while (start < end) {
106 const code = str.charCodeAt(start);
107 if (code !== 32 /* */ && code !== 9 /* \t */) break;
108 start++;
109 }
110
111 while (end > start) {
112 const code = str.charCodeAt(end - 1);
113 if (code !== 32 /* */ && code !== 9 /* \t */) break;
114 end--;
115 }
116
117 return str.slice(start, end);
118}
119
120function valueSliceTwoWhileExitEarly(str: string, min: number, max: number) {
121 if (min === max) return "";

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…