当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript undefined.default函数代码示例

本文整理汇总了TypeScript中undefined.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: handleCli

/**
 * @param {{cli: object, [whitelist]: array, [cb]: function}} opts
 * @returns {*}
 */
function handleCli(opts) {
    opts.cb = opts.cb || utils.defaultCallback;
    const m = require(`./cli/command.${opts.cli.input[0]}`);
    if (m.default) {
        return m.default(opts);
    }
    return m(opts);
}
开发者ID:BrowserSync,项目名称:browser-sync,代码行数:12,代码来源:bin.ts

示例2: send

            (event: Electron.Event, task: ITask) => {
                function send(taskResult: ITaskResult) {
                    // send result back to calling process
                    EEZStudio.electron.ipcRenderer.sendTo(
                        task.windowId,
                        TASK_DONE_CHANNEL + task.taskId,
                        taskResult
                    );
                }

                function sendResult(result: any) {
                    send({ result });
                }

                function sendError(error: any) {
                    send({ error });
                }

                try {
                    const serviceImplementation: (
                        inputParams: any
                    ) => Promise<any> = require(task.serviceName).default;

                    serviceImplementation(task.inputParams)
                        .then(sendResult)
                        .catch(sendError);
                } catch (error) {
                    sendError(error);
                }
            }
开发者ID:eez-open,项目名称:studio,代码行数:30,代码来源:service.ts

示例3: task

  gulp.task(taskname, (done: any) => {
    const task = require(TASK);
    if (task.length > 0) {
      return task(done);
    }

    const taskReturnedValue = task();
    if (isstream(taskReturnedValue)) {
      return taskReturnedValue;
    }

    // TODO: add promise handling if needed at some point.

    done();
  });
开发者ID:AriFreyr,项目名称:EveApp,代码行数:15,代码来源:tasks_tools.ts

示例4: getTestPaths

  async getTestPaths(
    globalConfig: Config.GlobalConfig,
    changedFiles: ChangedFiles | undefined,
  ): Promise<SearchResult> {
    const searchResult = this._getTestPaths(globalConfig, changedFiles);

    const filterPath = globalConfig.filter;

    if (filterPath && !globalConfig.skipFilter) {
      const tests = searchResult.tests;

      const filter = require(filterPath);
      const filterResult: {filtered: Array<FilterResult>} = await filter(
        tests.map(test => test.path),
      );

      if (!Array.isArray(filterResult.filtered)) {
        throw new Error(
          `Filter ${filterPath} did not return a valid test list`,
        );
      }

      const filteredSet = new Set(
        filterResult.filtered.map(result => result.test),
      );

      return {
        ...searchResult,
        tests: tests.filter(test => filteredSet.has(test.path)),
      };
    }

    return searchResult;
  }
开发者ID:Volune,项目名称:jest,代码行数:34,代码来源:SearchSource.ts

示例5: load

    /**
     * Load the given list of npm plugins.
     *
     * @param plugins  A list of npm modules that should be loaded as plugins. When not specified
     *   this function will invoke [[discoverNpmPlugins]] to find a list of all installed plugins.
     * @returns TRUE on success, otherwise FALSE.
     */
    load(): boolean {
        const logger = this.application.logger;
        const plugins = this.plugins || this.discoverNpmPlugins();

        let i: number, c: number = plugins.length;
        for (i = 0; i < c; i++) {
            const plugin = plugins[i];
            if (typeof plugin !== 'string') {
                logger.error('Unknown plugin %s', plugin);
                return false;
            } else if (plugin.toLowerCase() === 'none') {
                return true;
            }
        }

        for (i = 0; i < c; i++) {
            const plugin = plugins[i];
            try {
                const instance = require(plugin);
                const initFunction = typeof instance.load === 'function'
                    ? instance.load
                    : instance                // support legacy plugins
                    ;
                if (typeof initFunction === 'function') {
                    instance(this);
                    logger.write('Loaded plugin %s', plugin);
                } else {
                    logger.error('Invalid structure in plugin %s, no function found.', plugin);
                }
            } catch (error) {
                logger.error('The plugin %s could not be loaded.', plugin);
                logger.writeln(error.stack);
            }
        }
    }
开发者ID:deepeshdesigns,项目名称:typedoc,代码行数:42,代码来源:plugins.ts

示例6: require

process.on('message', (message: RPC.Message) => {
	switch (message.type) {
		case 'start':
			cwd = (message as RPC.Start).cwd;
			console.log(`Starting patternplate in ${cwd}`);
			process.chdir(cwd);
			const patternplatePath = path.join(cwd, 'node_modules', 'patternplate') || 'patternplate';
			const patternplate = require(patternplatePath);
			patternplate({
				mode: 'server'
			}).then(app => {
				// set and freeze logger
				app.log.deploy(new Logger());
				app.log.deploy = function() {}

				return app.start()
					.then(() => app);
			}).then(app => {
				const port = app.configuration.server.port;
				console.log(`Started patternplate on port '${port}'`)
				process.send({
					type: 'started',
					port
				} as RPC.Started);
			}).catch(error => {
				console.log(JSON.stringify(error));
				process.send({
					type: 'error',
					error: error.message
				} as RPC.Error)
			});
			break;
	}
});
开发者ID:sinnerschrader,项目名称:patternplate-vscode,代码行数:34,代码来源:patternplate-process.ts

示例7: require

cli.main(function(args, options) {
    try {
        if(cli.command) {
            if(commands.indexOf(cli.command) < 0) throw Error('Invalid command: ' + cli.command);

            // First try to run the `portable-js` package that is installed in folder where manifest file is located,
            // if not found, run the command from the global package.
            var manifest_dir = '';
            if(options.file) {
                manifest_dir = path.dirname(options.file);
            } else {
                manifest_dir = process.cwd();
            }
            var command_dir = manifest_dir + '/node_modules/portable-js/src/command';
            if(!fs.existsSync(command_dir)) command_dir = __dirname + '/command';

            if(options.verbose) log.level = 'verbose';
            if(options.debug) log.level = 'silly';

            var cmd = require(command_dir + '/' + cli.command + '.js');
            cmd(args, options);
        } else {
            log.error('Command not found: ' + cli.command);
        }
    } catch(e) {
        log.error(e);
        if(options.debug) {
            console.log(e.stack || e);
        }
    }

});
开发者ID:streamich,项目名称:portable,代码行数:32,代码来源:cli.ts

示例8: request

 doRequest(options: RequestOptions) {
   this.logger.info(`[ ${options.method} ] : ` + options.uri);
   //request.debug = true;
   
   options.headers = this.headers;
   return request(options);
 }
开发者ID:rey-symphony,项目名称:node-symphony,代码行数:7,代码来源:APIBase.ts

示例9: run

async function run(app: string, version: string, verbose: boolean) {
  const allDependencies = [appendVersion('tux-scripts', version)]

  console.log('Installing packages. This might take a couple minutes.')

  const useYarn = shouldUseYarn()

  const isOnline = await checkIfOnline(useYarn)

  console.log(`Installing ${chalk.cyan('tux-scripts')}...`)
  console.log()

  await install(useYarn, allDependencies, verbose, isOnline)

  checkNodeVersion()

  // Since react-scripts has been installed with --save
  // we need to move it into devDependencies and rewrite package.json
  // also ensure react dependencies have caret version range
  await fixDependencies()

  const scriptsPath = path.resolve(
    process.cwd(),
    'node_modules',
    'tux-scripts',
    'new'
  )
  const init = require(scriptsPath)
  await init(root, app, verbose)
}
开发者ID:aranja,项目名称:tux,代码行数:30,代码来源:new.ts

示例10: task

    gulp.task(taskname, function (cb: any) {
        let task = require('./' + TASK);
        if (task.length > 0) {
            return task(cb);
        }

    });
开发者ID:garyttierney,项目名称:blog,代码行数:7,代码来源:gulpfile.ts


注:本文中的undefined.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。