Expand description
JavaScript string and number built-ins that upstream code relies on.
Use these instead of Rust equivalents when porting: they differ in edge cases
(parseInt("12px") is 12; " x\u{FEFF}".trim() removes the BOM; substring counts UTF-16 units).
Functionsยง
- is_
js_ whitespace - JS
WhiteSpace+LineTerminator, as used byString.prototype.trim. - js_
parse_ float parseFloat(s). ReturnsNaNif no number prefix.- js_
parse_ int parseInt(s)(radix 10).NoneisNaN. Saturates instead of losing precision pasti64.- js_
substring_ from s.substring(start)wherestartcounts UTF-16 units.- js_trim
s.trim().- utf16_
to_ byte_ offset - Byte offset of the
units-th UTF-16 code unit ins(clamped to the end, and moved forward to a char boundary if it falls inside a surrogate pair).