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


TypeScript joi.func函数代码示例

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


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

示例1: isKibanaConfiguration

function isKibanaConfiguration(maybeConfiguration: any): maybeConfiguration is KibanaConfiguration {
  return (
    Joi.validate(
      maybeConfiguration,
      Joi.object({
        get: Joi.func().required(),
      }).unknown()
    ).error === null
  );
}
开发者ID:elastic,项目名称:kibana,代码行数:10,代码来源:kibana_configuration_adapter.ts

示例2: isServerWithConfig

function isServerWithConfig(maybeServer: any): maybeServer is ServerWithConfig {
  return (
    Joi.validate(
      maybeServer,
      Joi.object({
        config: Joi.func().required(),
      }).unknown()
    ).error === null
  );
}
开发者ID:elastic,项目名称:kibana,代码行数:10,代码来源:kibana_configuration_adapter.ts

示例3: validate

} from 'joi';
import { isPlainObject } from 'lodash';
import { isDuration } from 'moment';
import { ByteSizeValue, ensureByteSizeValue } from '../byte_size_value';
import { ensureDuration } from '../duration';

export { AnySchema, Reference, SchemaLike, ValidationErrorItem };

function isMap<K, V>(o: any): o is Map<K, V> {
  return o instanceof Map;
}

const anyCustomRule: Rules = {
  name: 'custom',
  params: {
    validator: Joi.func()
      .maxArity(1)
      .required(),
  },
  validate(params, value, state, options) {
    let validationResultMessage;
    try {
      validationResultMessage = params.validator(value);
    } catch (e) {
      validationResultMessage = e.message || e;
    }

    if (typeof validationResultMessage === 'string') {
      return this.createError(
        'any.custom',
        { value, message: validationResultMessage },
开发者ID:elastic,项目名称:kibana,代码行数:31,代码来源:index.ts

示例4: function

		version: '1.0.0'
	}
};

internals['schema'] = Joi.object({
	session: Joi.string().default('sid'),
	ttl: Joi.number().integer().min(0).when('keepAlive', { is: true, then: Joi.required() }),
	domain: Joi.string().allow(null),
	path: Joi.string().default('/'),
	clearInvalid: Joi.boolean().default(false),
	keepAlive: Joi.boolean().default(false),
	isSecure: Joi.boolean().default(true),
	isHttpOnly: Joi.boolean().default(true),
	appendNext: Joi.alternatives(Joi.string(), Joi.boolean()).default(false),
	redirectOnTry: Joi.boolean().default(true),
	validateFunc: Joi.func(),
	requestDecoratorName: Joi.string().default('cookieAuth')
}).required();

internals['implementation'] = function(server, options) {
	const results = Joi.validate(options, internals['schema']);
	Hoek.assert(!results.error, results.error);

	const settings = results.value;

	const scheme = {
		authenticate: function(request, reply) {
			const validate = function() {
				// Check session
				const session = request.yar.get(settings.session);
				if (!session) {
开发者ID:starlightslo,项目名称:hapi-ts-gulp-mvc-example,代码行数:31,代码来源:hapi-auth-local.ts

示例5:

/**
 * A task definition with all of its properties set to a valid value.
 */
export interface SanitizedTaskDefinition extends TaskDefinition {
  numWorkers: number;
}

export const validateTaskDefinition = Joi.object({
  type: Joi.string().required(),
  title: Joi.string().optional(),
  description: Joi.string().optional(),
  timeout: Joi.string().default('5m'),
  numWorkers: Joi.number()
    .min(1)
    .default(1),
  createTaskRunner: Joi.func().required(),
}).default();

/**
 * A dictionary mapping task types to their definitions.
 */
export interface TaskDictionary<T extends TaskDefinition> {
  [taskType: string]: T;
}

export type TaskStatus = 'idle' | 'running' | 'failed';

/*
 * A task instance represents all of the data required to store, fetch,
 * and execute a task.
 */
开发者ID:liuyepiaoxiang,项目名称:kibana,代码行数:31,代码来源:task.ts

示例6:

    })
  }),

  'weapp': Joi.object().keys({
    'compile': Joi.object().keys({
      'exclude': Joi.array().items(Joi.string())
    }),
    'module': Joi.object() // 第三方配置
  }),

  'h5': Joi.object().keys({
    'devServer': Joi.object(), // 第三方配置
    'publicPath': Joi.string(),
    'staticDirectory': Joi.string(),
    'chunkDirectory': Joi.string(),
    'webpackChain': Joi.func(),

    // DEPRECATED: https://nervjs.github.io/taro/docs/config-detail.html#deprecated-h5webpack
    'webpack': Joi.forbidden(),

    // https://webpack.js.org/configuration/resolve/#resolve-alias
    'alias': Joi.object().pattern(
      Joi.string(), Joi.string().strict()
    ),

    // https://webpack.js.org/configuration/entry-context/#entry
    'entry': Joi.alternatives(
      Joi.string(),
      Joi.array().items(Joi.alternatives(
        Joi.string(),
        Joi.object().pattern(
开发者ID:YangShaoQun,项目名称:taro,代码行数:31,代码来源:configSchema.ts

示例7:

      .items(Joi.string())
      .default([]),

    suiteTags: Joi.object()
      .keys({
        include: Joi.array()
          .items(Joi.string())
          .default([]),
        exclude: Joi.array()
          .items(Joi.string())
          .default([]),
      })
      .default(),

    services: Joi.object()
      .pattern(ID_PATTERN, Joi.func().required())
      .default(),

    pageObjects: Joi.object()
      .pattern(ID_PATTERN, Joi.func().required())
      .default(),

    timeouts: Joi.object()
      .keys({
        find: Joi.number().default(10000),
        try: Joi.number().default(120000),
        waitFor: Joi.number().default(20000),
        esRequestTimeout: Joi.number().default(30000),
        kibanaStabilize: Joi.number().default(15000),
        navigateStatusPageCheck: Joi.number().default(250),
开发者ID:elastic,项目名称:kibana,代码行数:30,代码来源:schema.ts


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