Function()

Dynamically get the Function by name.

Signature

Function(name: String): Any

Description

The Function() method gets the name function.

Parameters

Parameter Type Required Description

name

String

Yes

Function name

Return value

Type Description

Any

The name function.

Examples

Get the function by directly naming the function:

// Call function named `inventory`
inventory('pizza')
{
  data: [
    {
      name: "pizza",
      description: "Frozen Cheese",
      quantity: 92
    }
  ]
}

 

This equivalent expression gets the function by passing the name of the function as a parameter:

Function('inventory')('pizza')
{
  data: [
    {
      name: "pizza",
      description: "Frozen Cheese",
      quantity: 92
    }
  ]
}

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!