use Array.isArray instead of _.isArray

This commit is contained in:
Sebastian McKenzie
2015-01-10 22:26:37 +11:00
parent 13a52dd300
commit 1985146760
4 changed files with 7 additions and 7 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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");
};