Skip to main content

obj_to_string

Function obj_to_string 

Source
pub(crate) fn obj_to_string(
    it: &mut Interp,
    t: Value,
    _a: &[Value],
) -> Result<Value, Value>
Expand description

Object.prototype.toString.call(x){}.toString() 含む)。以前は this の 実際の種別を一切見ず常に "[object Object]" を返しており、lodash 等の ライブラリで広く使われる型判定イディオム(Object.prototype.toString.call(x) === '[object Array]' 等)が配列/Map/Set/Date/RegExp/関数のいずれに対しても 常に "[object Object]" になってしまう、実用上かなり影響の大きいバグだった。