• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript config.has函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: readLogConfig

function readLogConfig(): LogConfig {
  const requiredHTTP: string[] = ['ssl', 'method', 'host', 'port', 'path', 'level'];
  const requiredFile: string[] = ['dir', 'filename', 'maxSizeInKB', 'level'];
  const requiredConsole: string[] = ['logConsole', 'level'];

  let config: LogConfig = {
    http: has('log.http') ? readRequired(_.map(requiredHTTP, (name) => 'log.http.' + name), 'log.http.') : undefined,
    file: has('log.file') ? readRequired(_.map(requiredFile, (name) => 'log.file.' + name), 'log.file.') : undefined,
    console: has('log.console') ? readRequired(_.map(requiredConsole, (name) => 'log.console.' + name), 'log.console.') : undefined,
  };

  return config;
};
开发者ID:cuponthetop,项目名称:bg-hub,代码行数:13,代码来源:config-reader.ts


示例2: checkMissedConfig

// Check the config files
function checkMissedConfig () {
  const required = [ 'listen.port', 'listen.hostname',
    'webserver.https', 'webserver.hostname', 'webserver.port',
    'trust_proxy',
    'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
    'redis.hostname', 'redis.port', 'redis.auth', 'redis.db',
    'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address',
    'storage.avatars', 'storage.videos', 'storage.logs', 'storage.previews', 'storage.thumbnails', 'storage.torrents', 'storage.cache',
    'log.level',
    'user.video_quota',
    'cache.previews.size', 'admin.email',
    'signup.enabled', 'signup.limit', 'signup.filters.cidr.whitelist', 'signup.filters.cidr.blacklist',
    'transcoding.enabled', 'transcoding.threads',
    'instance.name', 'instance.short_description', 'instance.description', 'instance.terms', 'instance.default_client_route',
    'instance.default_nsfw_policy', 'instance.robots',
    'services.twitter.username', 'services.twitter.whitelisted'
  ]
  const miss: string[] = []

  for (const key of required) {
    if (!config.has(key)) {
      miss.push(key)
    }
  }

  return miss
}
开发者ID:jiang263,项目名称:PeerTube,代码行数:28,代码来源:checker.ts


示例3: url

function url (serviceName: string): string {
  const healthCheckUrlLocation = `${serviceName}.infoContributorUrl`

  if (config.has(healthCheckUrlLocation)) {
    return config.get<string>(healthCheckUrlLocation)
  } else {
    return config.get<string>(`${serviceName}.url`) + '/info'
  }
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:9,代码来源:info.ts


示例4: checkConfig

// Some checks on configuration files
function checkConfig () {
  if (config.has('webserver.host')) {
    let errorMessage = '`host` config key was renamed to `hostname` but it seems you still have a `host` key in your configuration files!'
    errorMessage += ' Please ensure to rename your `host` configuration to `hostname`.'

    return errorMessage
  }

  return null
}
开发者ID:quoidautre,项目名称:PeerTube,代码行数:11,代码来源:checker.ts


示例5: checkMissedConfig

// Check the config files
function checkMissedConfig () {
  const required = [ 'listen.port',
    'webserver.https', 'webserver.hostname', 'webserver.port',
    'database.hostname', 'database.port', 'database.suffix', 'database.username', 'database.password',
    'storage.videos', 'storage.logs', 'storage.thumbnails', 'storage.previews', 'storage.torrents', 'storage.cache', 'log.level',
    'cache.previews.size', 'admin.email', 'signup.enabled', 'signup.limit', 'transcoding.enabled', 'transcoding.threads',
    'user.video_quota', 'smtp.hostname', 'smtp.port', 'smtp.username', 'smtp.password', 'smtp.tls', 'smtp.from_address',
    'instance.name', 'instance.description', 'instance.terms'
  ]
  const miss: string[] = []

  for (const key of required) {
    if (!config.has(key)) {
      miss.push(key)
    }
  }

  return miss
}
开发者ID:quoidautre,项目名称:PeerTube,代码行数:20,代码来源:checker.ts


示例6:

/// <reference path="config.d.ts" />

import * as config from "config";

var class1: config.IConfig = config;

var value1: string = config.get<string>("");
var value2: any = config.get("");

var has: boolean = config.has("");

// util tests:
var extended1: any = config.util.extendDeep({}, {});
var extended2: any = config.util.extendDeep({}, {}, 20);

var clone1: any = config.util.cloneDeep({});
var clone2: any = config.util.cloneDeep({}, 20);

var equals1: boolean = config.util.equalsDeep({}, {});
var equals2: boolean = config.util.equalsDeep({}, {}, 20);

var diff1: any = config.util.diffDeep({}, {});
var diff2: any = config.util.diffDeep({}, {}, 20);

var immutable1: any = config.util.makeImmutable({});
var immutable2: any = config.util.makeImmutable({}, "");
var immutable3: any = config.util.makeImmutable({}, "", "");

var hidden1: any = config.util.makeHidden({}, "");
var hidden2: any = config.util.makeHidden({}, "", "");
开发者ID:0815fox,项目名称:DefinitelyTyped,代码行数:30,代码来源:config-tests.ts


示例7: has

 return _.reduce(optional, (result: any, item: OptionalItem) => {
   return _.set(result, item.name.replace(regex, ''), has(item.name) ? get(item.name) : item.defaultValue);
 }, {});
开发者ID:cuponthetop,项目名称:bg-hub,代码行数:3,代码来源:config-reader.ts


示例8: Error

throw new Error(`Required configuration was not found: ` + _.map(required, (name: string) => `${name}: ${has(name)} - ${has(name) ? get(name) : '"undefined"'}, `).join());
开发者ID:cuponthetop,项目名称:bg-hub,代码行数:1,代码来源:config-reader.ts


示例9:

 if (false === _.every(required, (name: string) => has(name))) {
开发者ID:cuponthetop,项目名称:bg-hub,代码行数:1,代码来源:config-reader.ts


示例10: hasConfig

 hasConfig(key: string): boolean {
   return config.has(key);
 }
开发者ID:yruan,项目名称:inceptum,代码行数:3,代码来源:ConfigProvider.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript config-parser.Ast类代码示例发布时间:2022-05-25
下一篇:
TypeScript config.get函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap