JS `\s` (WhiteSpace ∪ LineTerminator) — differs from Rust's `\p{White_Space}` on U+FEFF (JS: yes) and U+0085 (JS: no). The chained-call inner-callee strip (`.replace(/\s+/g, '')`) runs on arbitrary source slices, so match JS exactly.
(c: char)
| 84 | /// on U+FEFF (JS: yes) and U+0085 (JS: no). The chained-call inner-callee strip |
| 85 | /// (`.replace(/\s+/g, '')`) runs on arbitrary source slices, so match JS exactly. |
| 86 | fn is_js_space(c: char) -> bool { |
| 87 | matches!( |
| 88 | c, |
| 89 | '\t' | '\n' | '\x0B' | '\x0C' | '\r' | ' ' | '\u{00A0}' | '\u{1680}' |
| 90 | | '\u{2000}'..='\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' |
| 91 | | '\u{3000}' | '\u{FEFF}' |
| 92 | ) |
| 93 | } |
| 94 | fn strip_js_ws(s: &str) -> String { |
| 95 | s.chars().filter(|c| !is_js_space(*c)).collect() |
| 96 | } |