import { i18n } from '@osd/i18n' ; import { ExpressionFunctionDefinition , OpenSearchDashboardsDatatable , Range , } from '../../../expressions/public' ; interface Arguments { from : number ; to : number ; } export const range = ( ) : ExpressionFunctionDefinition < 'range' , OpenSearchDashboardsDatatable | null , Arguments , Range > => ( { name : 'range' , help : i18n . translate ( 'visualizations.function.range.help' , { defaultMessage : 'Generates range object' , } ) , type : 'range' , args : { from : { types : [ 'number' ] , help : i18n . translate ( 'visualizations.function.range.from.help' , { defaultMessage : 'Start of range' , } ) , required : true , } , to : { types : [ 'number' ] , help : i18n . translate ( 'visualizations.function.range.to.help' , { defaultMessage : 'End of range' , } ) , required : true , } , } , fn : ( context , args ) => { return { type : 'range' , from : args . from , to : args . to , } ; } , } ) ;