Comparing version 1.1.8 to 2.0.0-canary-1
20
index.js
@@ -10,13 +10,16 @@ 'use strict'; | ||
options = options || {includeDependencies: false}; | ||
var parents = options.parents = options.parents || []; | ||
var parents = (options.parents = options.parents || []); | ||
var replace = function replace(replacement) { | ||
if (Array.isArray(replacement) && !replace.arrayAllowed) { | ||
throw new Error('replace() can only be called with an array if the last parent is a Block or NamedBlock'); | ||
throw new Error( | ||
'replace() can only be called with an array if the last parent is a Block or NamedBlock' | ||
); | ||
} | ||
ast = replacement; | ||
}; | ||
replace.arrayAllowed = parents[0] && ( | ||
/^(Named)?Block$/.test(parents[0].type) || | ||
parents[0].type === 'RawInclude' && ast.type === 'IncludeFilter'); | ||
replace.arrayAllowed = | ||
parents[0] && | ||
(/^(Named)?Block$/.test(parents[0].type) || | ||
(parents[0].type === 'RawInclude' && ast.type === 'IncludeFilter')); | ||
@@ -60,2 +63,7 @@ if (before) { | ||
break; | ||
case 'EachOf': | ||
if (ast.block) { | ||
ast.block = walkAST(ast.block, before, after, options); | ||
} | ||
break; | ||
case 'Conditional': | ||
@@ -105,3 +113,3 @@ if (ast.consequent) { | ||
function walkAndMergeNodes(nodes) { | ||
return nodes.reduce(function (nodes, node) { | ||
return nodes.reduce(function(nodes, node) { | ||
var result = walkAST(node, before, after, options); | ||
@@ -108,0 +116,0 @@ if (Array.isArray(result)) { |
{ | ||
"name": "pug-walk", | ||
"version": "1.1.8", | ||
"version": "2.0.0-canary-1", | ||
"description": "Walk and transform a pug AST", | ||
@@ -9,4 +9,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"pug-lexer": "^4.1.0", | ||
"pug-parser": "^5.0.1" | ||
"pug-lexer": "5.0.0-canary-1", | ||
"pug-parser": "6.0.0-canary-1" | ||
}, | ||
@@ -21,4 +21,3 @@ "files": [ | ||
"author": "ForbesLindesay", | ||
"license": "MIT", | ||
"gitHead": "1bdf628a70fda7a0d840c52f3abce54b1c6b0130" | ||
"license": "MIT" | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
9638
112
2
1