kibana/x-pack/plugins/canvas/common/functions/to.js
Spencer e618cf43da
[6.x] [@kbn/interpreter] improve build/packaging (#26096) (#26136)
* [@kbn/interpreter] improve build/packaging (#26096)

Summary of changes:

 - move all build artifacts under `target` directory
 - run babel and webpack in parallel
 - support optional watch and sourcemaps in build
 - expose /common /public /plugin /server sub-exports as index.js
 - avoid importing deeply from `@kbn/interpreter`
 - move a couple missed dependencies from x-pack to kibana
 - remove custom babel-register implementation

* fix bad conflict resolution
2018-11-24 12:26:07 -07:00

27 lines
719 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';
export const to = () => ({
name: 'to',
aliases: [],
help: 'Explicitly cast from one type to another',
context: {},
args: {
type: {
types: ['string'],
help: 'A known type',
aliases: ['_'],
multi: true,
},
},
fn: (context, args, { types }) => {
if (!args.type) throw new Error('Must specify a casting type');
return castProvider(types)(context, args.type);
},
});