x-tag/core — pull request #27 by WebReflection (2013-08-23 22:13:44+00:00)
Title: Update core.js

as you can [verify in this page](http://jsperf.com/typeof) the previously used `typeOf` function, potentially invoked many times during a mobile app lifecycle, is much slower plus it creates a lot of garbage (a `new RegExp` each call and its matched `Array`).

If one of this wonderful library is to make it usable from all devices out there, a consideration for these kind of tweaks would be highly appreciated.

The current version is using a smart technique to reach best performance and cost almost nothing from the second time it gets invoked with similar types or objects and it avoids the creation of garbage. The number of static strings increases potentially with variety of native instances passed to the callback but these won't be a warning number with current ES3 to 6 specs/scenario.

Please accept this patch or at least avoid creating garbage each time.

```javascript
var typeObj = {};
var re = /\w+(?=])/;
function typeOf2(obj) {
return typeObj.toString.call(obj).test(re) &&
RegExp.lastMatch.toLowerCase();
}
```

Best Regards