lib/cjs_amd.js
function visitRequireArgument(ast, cb) {
	types.visit(ast, {
		visitCallExpression: function(path) {
			if (this.isRequireExpression(path.node)) {
				var arg = path.getValueProperty("arguments")[0];

				if (n.Literal.check(arg)) {
					cb(arg);
				}
			}

			this.traverse(path);
		},

		isRequireExpression(node) {
			return n.Identifier.check(node.callee) && node.callee.name === "require";
		}
	});
}
function visitRequireArgument(ast, cb) {
	types.visit(ast, {
		visitCallExpression: function(path) {
			if (this.isRequireExpression(path.node)) {
				var arg = path.getValueProperty("arguments")[0];

				if (n.Literal.check(arg)) {
					cb(arg);
				}
			}

			this.traverse(path);
		},

		isRequireExpression(node) {
			return n.Identifier.check(node.callee) && node.callee.name === "require";
		}
	});
}
function visitRequireArgument ( ast , cb ) { types . visit ( ast , { visitCallExpression : function ( path ) { if ( this . isRequireExpression ( path . node ) ) { var arg = path . getValueProperty ( "arguments" ) [ 0 ] ; if ( n . Literal . check ( arg ) ) { cb ( arg ) ; } } this . traverse ( path ) ; } , isRequireExpression ( node ) { return n . Identifier . check ( node . callee ) && node . callee . name === "require" ; } } ) ; }
Given an ast, calls the visitor with the first argument of each `require` call
@param {Object} ast - The ast to walk
@param {Function} cb - The visitor function called on each match
Given an ast calls the visitor with the first argument of each require call