Skip to main content

str_code_point_at

Function str_code_point_at 

Source
pub(crate) fn str_code_point_at(
    _: &mut Interp,
    t: Value,
    a: &[Value],
) -> Result<Value, Value>
Expand description

String.prototype.codePointAt()(ES2015)が丸ごと未実装だった(charCodeAt はあった)。 この処理系の文字列は Rust の String(既に UTF-8 のコードポイント単位)で保持されており サロゲートペアの概念自体が無いため、charCodeAt と等価な実装で足りる (範囲外は NaN ではなく仕様どおり undefined を返す点だけが異なる)。