regularjs/regular

减少_.typeOf使用

Closed this issue · 0 comments

Regular内部有个 fix typeof 操作符,

_.typeOf = function (o) {
  return o == null ? String(o) :o2str.call(o).slice(8, -1).toLowerCase();
}

它解决了在所有浏览器,返回的type的可靠性,但是遗憾的是它的性能非常捉急,下图是与原生typeof的对比

image

由于内部大量使用了typeOf, 还无法一次性去除,这个版本会移除部分冗余使用