mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [ML] Consolidating shared types and util functions * including formatter * adding missing includes * removing unused export * ignoring numeral type error Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
19 lines
669 B
TypeScript
19 lines
669 B
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
|
|
import { composeValidators, patternValidator } from '../../../../ml/public';
|
|
|
|
export type AggName = string;
|
|
|
|
export function isAggName(arg: any): arg is AggName {
|
|
// allow all characters except `[]>` and must not start or end with a space.
|
|
const validatorFn = composeValidators(
|
|
patternValidator(/^[^\s]/),
|
|
patternValidator(/[^\s]$/),
|
|
patternValidator(/^[^\[\]>]+$/)
|
|
);
|
|
return validatorFn(arg) === null;
|
|
}
|