Function.byName()

Get a user-defined Function document by its name.

Signature

Function.byName(name: string): FunctionDef | NullFunctionDef

Description

The Function.byName() method gets the Function object if it exists and is accessible.

Parameters

Parameter Type Required Description

name

String

Yes

Name of the UDF document to get.

Return value

One of:

Type Description

FunctionDef

Function object. See Function document definition.

NullFunctionDef

UDF document doesn’t exist or is inaccessible.

Examples

  1. Fetch a UDF when it exists and is accessible:

    Function.byName("Double")
    {
      name: "Double",
      coll: Function,
      ts: Time("2022-10-25T21:01:19.310Z"),
      body: "(x) => x + x"
    }
  2. When the UDF document doesn’t exist or is inaccessible:

    Function.byName("doesnotexist")
    null

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!