mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Synced up docs with function defs * Updated docs with changes from PR #37305 * Merged canvas function ref into a single doc * Fixed arg order * Fixed typo * Added alphabet links * Added alphabet headers * Removed B header * Added missing args from * Added edits from PR #37614 * Updated containerStyle * Removed metafields. ESSQL doesn't support retrieving metafields * Edits to function copy * More edits * More edits * Final round of edits * Fixed i18n errors * Addressing feedback * Fixed jest test * Fixed missing import * Fixed i18n error * Restored metaFields arg in esdocs * Extracted i18n string constants * Fixed i18n errors * Updated translation files
30 lines
826 B
JavaScript
30 lines
826 B
JavaScript
/*
|
|
* 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 { castProvider } from '@kbn/interpreter/common';
|
|
import { registries } from 'plugins/interpreter/registries';
|
|
|
|
export const to = () => ({
|
|
name: 'to',
|
|
aliases: [],
|
|
help: 'Explicitly casts the type of the _context_ to the specified type.',
|
|
context: {},
|
|
args: {
|
|
type: {
|
|
types: ['string'],
|
|
help: 'A known type',
|
|
aliases: ['_'],
|
|
multi: true,
|
|
},
|
|
},
|
|
fn: (context, args) => {
|
|
if (!args.type) {
|
|
throw new Error('Must specify a casting type');
|
|
}
|
|
|
|
return castProvider(registries.types.toJS())(context, args.type);
|
|
},
|
|
});
|