Improve getClass
performance. [#747 state:resolved]
This commit is contained in:
parent
add69978e0
commit
41b034b93b
@ -1,3 +1,5 @@
|
||||
* Remove expensive (for such low-level method) internal `getClass` in favor of plain string comparison (kangax)
|
||||
|
||||
* Fix `PeriodicalExecuter` so that it no longer suppresses exceptions. [#696 state:resolved] (Samuel Lebeau, Yaffle)
|
||||
|
||||
* Fix issue related to escaping of selectors for querySelectorAll. [#559 state:resolved] (Jorn Holm)
|
||||
|
@ -10,10 +10,7 @@
|
||||
**/
|
||||
(function() {
|
||||
|
||||
function getClass(object) {
|
||||
return Object.prototype.toString.call(object)
|
||||
.match(/^\[object\s(.*)\]$/)[1];
|
||||
}
|
||||
var _toString = Object.prototype.toString;
|
||||
|
||||
/**
|
||||
* Object.extend(destination, source) -> Object
|
||||
@ -198,7 +195,7 @@
|
||||
* Returns `true` if `object` is an array; false otherwise.
|
||||
**/
|
||||
function isArray(object) {
|
||||
return getClass(object) === "Array";
|
||||
return _toString.call(object) == "[object Array]";
|
||||
}
|
||||
|
||||
|
||||
@ -230,7 +227,7 @@
|
||||
* Returns `true` if `object` is of type `string`; `false` otherwise.
|
||||
**/
|
||||
function isString(object) {
|
||||
return getClass(object) === "String";
|
||||
return _toString.call(object) == "[object String]";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,7 +237,7 @@
|
||||
* Returns `true` if `object` is of type `number`; `false` otherwise.
|
||||
**/
|
||||
function isNumber(object) {
|
||||
return getClass(object) === "Number";
|
||||
return _toString.call(object) == "[object Number]";
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user