Optimize node type lookup

This commit is contained in:
Dan Abramov
2015-01-14 20:59:32 +03:00
parent 19eaa181a5
commit 58a91ee9e9
2 changed files with 54 additions and 39 deletions

View File

@@ -13,7 +13,7 @@ var find = function (obj, node, parent) {
for (var i = 0; i < types.length; i++) {
var type = types[i];
if (t["is" + type](node)) {
if (t.is(type, node)) {
var fn = obj[type];
result = fn(node, parent);
if (result != null) break;