basisjs-tools-ast
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -173,11 +173,14 @@ var htmlparser = require('htmlparser2'); | ||
getElementByName: function(node, name){ | ||
var nodes = Array.isArray(node) ? node.slice() : [node]; | ||
if (node) | ||
{ | ||
var nodes = Array.isArray(node) ? node.slice() : [node]; | ||
while (nodes.length) | ||
{ | ||
var node = nodes.shift(); | ||
if (node.name == name) | ||
return node; | ||
if (node.children) | ||
nodes.unshift.apply(nodes, node.children); | ||
while (nodes.length) | ||
{ | ||
var node = nodes.shift(); | ||
if (node.name == name) | ||
return node; | ||
if (node.children) | ||
nodes.unshift.apply(nodes, node.children); | ||
} | ||
} | ||
@@ -188,12 +191,16 @@ | ||
getElementsByName: function(node, name){ | ||
var nodes = Array.isArray(node) ? node.slice() : [node]; | ||
var result = []; | ||
while (nodes.length) | ||
if (node) | ||
{ | ||
var node = nodes.shift(); | ||
if (node.name == name) | ||
result.push(node); | ||
if (node.children) | ||
nodes.unshift.apply(nodes, node.children); | ||
var nodes = Array.isArray(node) ? node.slice() : [node]; | ||
while (nodes.length) | ||
{ | ||
var node = nodes.shift(); | ||
if (node.name == name) | ||
result.push(node); | ||
if (node.children) | ||
nodes.unshift.apply(nodes, node.children); | ||
} | ||
} | ||
@@ -200,0 +207,0 @@ |
{ | ||
"name": "basisjs-tools-ast", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Tool set for basisjs-tools to work with various AST", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/basisjs/basisjs-tools-ast", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
185017
5444