Contact Us 1-800-596-4880

functionParamTypes

functionParamTypes(t: Type): Array<FunctionParam>

Returns the list of parameters from the given function type. This function fails if the provided type is not a Function type.

Introduced in DataWeave version 2.3.0.

Parameters

Name Description

t

The function type.

Example

This example shows how functionParamTypes behaves with different inputs.

Source

%dw 2.0
output application/json
import * from dw::core::Types
type AFunction = (String, Number) -> Number
type AFunction2 = () -> Number
---
{
    a: functionParamTypes(AFunction),
    b: functionParamTypes(AFunction2)
}

Output

{
   "a": [
     {
       "paramType": "String",
       "optional": false
     },
     {
       "paramType": "Number",
       "optional": false
     }
   ],
   "b": [

   ]
 }