當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。