lib/amd/slim.js
function hasNestedDefine(ast) {
	var result = false;

	types.visit(ast, {
		visitCallExpression: function(path) {
			if (this.isDefineExpression(path)) {
				result = true;
				this.abort();
			}

			this.traverse(path);
		},

		// whether a non top level `define(` is call in the AST
		isDefineExpression: function(path) {
			return (
				n.Identifier.check(path.node.callee) &&
				path.node.callee.name === "define" &&
				!n.Program.check(path.parent.parent.node)
			);
		}
	});

	return result;
}
function hasNestedDefine(ast) {
	var result = false;

	types.visit(ast, {
		visitCallExpression: function(path) {
			if (this.isDefineExpression(path)) {
				result = true;
				this.abort();
			}

			this.traverse(path);
		},

		// whether a non top level `define(` is call in the AST
		isDefineExpression: function(path) {
			return (
				n.Identifier.check(path.node.callee) &&
				path.node.callee.name === "define" &&
				!n.Program.check(path.parent.parent.node)
			);
		}
	});

	return result;
}
function hasNestedDefine ( ast ) { var result = false ; types . visit ( ast , { visitCallExpression : function ( path ) { if ( this . isDefineExpression ( path ) ) { result = true ; this . abort ( ) ; } this . traverse ( path ) ; } , // whether a non top level `define(` is call in the AST isDefineExpression : function ( path ) { return ( n . Identifier . check ( path . node . callee ) && path . node . callee . name === "define" && ! n . Program . check ( path . parent . parent . node ) ) ; } } ) ; return result ; }
Whether there is a non top level `define` function call in the AST
@param {Object} ast - The AST to be checked
@return {boolean}
Whether there is a non top level define function call in the AST