From 962eeed25237c11c8ee38232c924a9ea34145a1b Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Wed, 28 Jan 2015 23:41:42 +1100 Subject: [PATCH] clean up t.getIds --- lib/6to5/types/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 4e960efffb..51752c3961 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -490,7 +490,11 @@ t.toBlock = function (node, parent) { }; /** - * Description + * Return a list of identifiers that will be assigned + * as a result of runtime evaluation. + * + * If an identifier is passed as `node` instead of a + * declaration then it's assumed to be an assignable. * * @param {Object} node * @param {Boolean} [map] @@ -499,15 +503,15 @@ t.toBlock = function (node, parent) { */ t.getIds = function (node, map, ignoreTypes) { - ignoreTypes = ignoreTypes || []; - var search = [].concat(node); var ids = object(); while (search.length) { var id = search.shift(); if (!id) continue; - if (_.contains(ignoreTypes, id.type)) continue; + + // blacklist types + if (ignoreTypes && ignoreTypes.indexOf(id.type) >= 0) continue; var nodeKeys = t.getIds.nodes[id.type]; var arrKeys = t.getIds.arrays[id.type];