(有人可能会相应更改标题)
当javascript' require
方法被调用时,会发生什么:
var xyz = require('xy')(require('z'));
谢谢
答案 0 :(得分:1)
无论z
模块导出将作为参数传递给从xy
导出的函数。
如果xy
没有导出某个功能,那么您会收到错误
答案 1 :(得分:1)
它的简称:
var xy = require('xy');
var z = require('z');
var xyz = xy(z);
答案 2 :(得分:1)
var gulp = require('gulp-help')(require('gulp'));
有效,因为require('gulp-help')
会返回一个函数,然后将gulp导出的模块作为参数连同选项
像
require('gulp-help')(require('gulp'), options);
These are all the options available to be passed to the gulp-help instance, NOT individual tasks.
description - modifies the default help message
aliases - adds aliases to the default help task
hideEmpty - hide all tasks with no help message defined. Useful when including 3rd party tasks
hideDepsMessage - hide all task dependencies
afterPrintCallback - a function to run after the default help task runs
这是
的简短形式var gulp-help = require('gulp-help');
var gulp = gulp-help(require('gulp'));