MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / jsws_len

Function jsws_len

codegraph-kernel/src/cfnptr.rs:114–132  ·  view source on GitHub ↗
(s: &[u8], i: usize)

Source from the content-addressed store, hash-verified

112///
113   ].
114#[inline]
115fn jsws_len(s: &[u8], i: usize) -> usize {
116 let Some(&b0) = s.get(i) else { return 0 };
117 match b0 {
118 0x09..=0x0D | 0x20 => 1,
119 0xC2 if s.get(i + 1) == Some(&0xA0) => 2, // U+00A0
120 0xE1 if s.get(i + 1) == Some(&0x9A) && s.get(i + 2) == Some(&0x80) => 3, // U+1680
121 0xE2 => match (s.get(i + 1), s.get(i + 2)) {
122 (Some(&0x80), Some(&b2)) if (0x80..=0x8A).contains(&b2) => 3, // U+2000-200A
123 (Some(&0x80), Some(&0xA8)) => 3, // U+2028
124 (Some(&0x80), Some(&0xA9)) => 3, // U+2029
125 (Some(&0x80), Some(&0xAF)) => 3, // U+202F
126 (Some(&0x81), Some(&0x9F)) => 3, // U+205F
127 _ => 0,
128 },
129 0xE3 if s.get(i + 1) == Some(&0x80) && s.get(i + 2) == Some(&0x80) => 3, // U+3000
130 0xEF if s.get(i + 1) == Some(&0xBB) && s.get(i + 2) == Some(&0xBF) => 3, // U+FEFF
131 _ => 0,
132 }
133}
134
135/// Advance past `\s*`.

Callers 2

skip_jswsFunction · 0.85
jsws_trimFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected