gas-entry-generator
Advanced tools
Comparing version 1.1.0 to 1.1.1
18
index.js
@@ -14,3 +14,3 @@ 'use strict'; | ||
function createStubFunctionASTNode(functionName, leadingComments) { | ||
function createStubFunctionASTNode(functionName, leadingComments, params) { | ||
var node = { | ||
@@ -34,2 +34,5 @@ type: 'FunctionDeclaration', | ||
} | ||
if (params) { | ||
node.params = params; | ||
} | ||
return node; | ||
@@ -41,2 +44,3 @@ } | ||
var stubs = []; | ||
var functionName; | ||
estraverse.traverse(ast, { | ||
@@ -46,4 +50,12 @@ leave: function (node) { | ||
&& isGlobalAssignmentExpression(node.expression)) { | ||
var functionName = node.expression.left.property.name; | ||
stubs.push(createStubFunctionASTNode(functionName, node.leadingComments)); | ||
functionName = node.expression.left.property.name; | ||
stubs.push(createStubFunctionASTNode(functionName, node.leadingComments, node.expression.right.params)); | ||
} else if (node.type === 'ExpressionStatement' | ||
&& node.expression.type === 'SequenceExpression') { | ||
node.expression.expressions.forEach(function (expression) { | ||
if (isGlobalAssignmentExpression(expression)) { | ||
functionName = expression.left.property.name; | ||
stubs.push(createStubFunctionASTNode(functionName, node.leadingComments, expression.right.params)); | ||
} | ||
}); | ||
} | ||
@@ -50,0 +62,0 @@ } |
{ | ||
"name": "gas-entry-generator", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Generator of Google Apps Script entry point function", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,7 @@ /** | ||
// leading line comment for boo | ||
function boo() { | ||
function boo(message) { | ||
} | ||
function test() { | ||
} | ||
function X() { | ||
} |
@@ -11,3 +11,7 @@ /** | ||
// leading line comment for boo | ||
global.boo = function () { | ||
global.boo = function (message) { | ||
}; | ||
function test() { | ||
}; | ||
var X = 'x'; | ||
global.test = test, global.X = X; |
6178
123