From 198514676034880c1c9d4ef039a28568adda5d46 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sat, 10 Jan 2015 22:26:37 +1100 Subject: [PATCH] use Array.isArray instead of _.isArray --- lib/6to5/generation/buffer.js | 2 +- lib/6to5/traverse/index.js | 6 +++--- lib/6to5/types/index.js | 2 +- lib/6to5/util.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/6to5/generation/buffer.js b/lib/6to5/generation/buffer.js index 1ba135089f..c9b4e662fe 100644 --- a/lib/6to5/generation/buffer.js +++ b/lib/6to5/generation/buffer.js @@ -123,7 +123,7 @@ Buffer.prototype.isLast = function (cha, trimRight) { if (trimRight) buf = util.trimRight(buf); var last = buf[buf.length - 1]; - if (_.isArray(cha)) { + if (Array.isArray(cha)) { return _.contains(cha, last); } else { return cha === last; diff --git a/lib/6to5/traverse/index.js b/lib/6to5/traverse/index.js index 4abec958c4..5667ce1f46 100644 --- a/lib/6to5/traverse/index.js +++ b/lib/6to5/traverse/index.js @@ -33,7 +33,7 @@ TraversalContext.prototype.maybeReplace = function (result, obj, key, node) { if (result === false) return node; if (result == null) return node; - var isArray = _.isArray(result); + var isArray = Array.isArray(result); // inherit comments from original node to the first replacement node var inheritTo = result; @@ -96,7 +96,7 @@ function traverse(parent, opts, scope) { if (!parent) return; // array of nodes - if (_.isArray(parent)) { + if (Array.isArray(parent)) { for (var i = 0; i < parent.length; i++) traverse(parent[i], opts, scope); return; @@ -114,7 +114,7 @@ function traverse(parent, opts, scope) { var nodes = parent[key]; if (!nodes) continue; - if (_.isArray(nodes)) { + if (Array.isArray(nodes)) { for (var k = 0; k < nodes.length; k++) { context = new TraversalContext(context); context.visit(nodes, k, opts, scope, parent); diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 9dc4584376..c132e8860a 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -320,7 +320,7 @@ t.toBlock = function (node, parent) { return node; } - if (!_.isArray(node)) { + if (!Array.isArray(node)) { if (!t.isStatement(node)) { if (t.isFunction(parent)) { node = t.returnStatement(node); diff --git a/lib/6to5/util.js b/lib/6to5/util.js index ee5c332ff7..e96d638d21 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -39,7 +39,7 @@ exports.list = function (val) { exports.regexify = function (val) { if (!val) return new RegExp(/.^/); - if (_.isArray(val)) val = val.join("|"); + if (Array.isArray(val)) val = val.join("|"); if (_.isString(val)) return new RegExp(val); if (_.isRegExp(val)) return val; throw new TypeError("illegal type for regexify"); @@ -48,7 +48,7 @@ exports.regexify = function (val) { exports.arrayify = function (val) { if (!val) return []; if (_.isString(val)) return exports.list(val); - if (_.isArray(val)) return val; + if (Array.isArray(val)) return val; throw new TypeError("illegal type for arrayify"); };