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)
| 95 | /// on U+FEFF (JS: yes) and U+0085 (JS: no). The chained-call inner-callee strip |
| 96 | /// (`.replace(/\s+/g, '')`) runs on arbitrary source slices, so match JS exactly. |
| 97 | fn is_js_space(c: char) -> bool { |
| 98 | matches!( |
| 99 | c, |
| 100 | '\t' | '\n' | '\x0B' | '\x0C' | '\r' | ' ' | '\u{00A0}' | '\u{1680}' |
| 101 | | '\u{2000}'..='\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' |
| 102 | | '\u{3000}' | '\u{FEFF}' |
| 103 | ) |
| 104 | } |
| 105 | fn strip_js_ws(s: &str) -> String { |
| 106 | s.chars().filter(|c| !is_js_space(*c)).collect() |
| 107 | } |