# Analytics Hub V1 API - Class Google::Cloud::Bigquery::AnalyticsHub::V1::JavaScriptUDF (v0.19.0)

0.19.0 (latest) 0.18.0 0.17.0 0.16.1 0.15.0 0.14.0 0.13.1 0.12.0 0.11.1 0.10.0 0.9.0 0.8.1 0.7.0 0.6.0 0.5.2 0.4.0 0.3.0 0.2.1 0.1.0 Reference documentation and code samples for the Analytics Hub V1 API class Google::Cloud::Bigquery::AnalyticsHub::V1::JavaScriptUDF.

User-defined JavaScript function that can transform or filter a Pub/Sub
message.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #code

    def code() -> ::String

**Returns**

- (::String) --- Required. JavaScript code that contains a function `function_name` with the below signature:


  \`\`\`
  /\*\*
  - Transforms a Pub/Sub message.

  - @return {(Object

    <br />

  - filter a message, return `null`. To transform a message return a map

  - with the following keys:

  -
    - (required) 'data' : {string}
  -
    - (optional) 'attributes' : {Object
  - Returning empty `attributes` will remove all attributes from the

  - message.
    \*

  - @param {(Object

    <br />

  - message. Keys:

  -
    - (required) 'data' : {string}
  -
    - (required) 'attributes' : {Object
  - @param {Object

    <br />

  - Keys:

  -
    - (required) 'message_id' : {string}
  -
    - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
  -
    - (optional) 'ordering_key': {string} \*/

  function

### #code=

    def code=(value) -> ::String

**Parameter**

- **value** (::String) --- Required. JavaScript code that contains a function `function_name` with the below signature:


  \`\`\`
  /\*\*
  - Transforms a Pub/Sub message.

  - @return {(Object

    <br />

  - filter a message, return `null`. To transform a message return a map

  - with the following keys:

  -
    - (required) 'data' : {string}
  -
    - (optional) 'attributes' : {Object
  - Returning empty `attributes` will remove all attributes from the

  - message.
    \*

  - @param {(Object

    <br />

  - message. Keys:

  -
    - (required) 'data' : {string}
  -
    - (required) 'attributes' : {Object
  - @param {Object

    <br />

  - Keys:

  -
    - (required) 'message_id' : {string}
  -
    - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
  -
    - (optional) 'ordering_key': {string} \*/

  function
**Returns**

- (::String) --- Required. JavaScript code that contains a function `function_name` with the below signature:


  \`\`\`
  /\*\*
  - Transforms a Pub/Sub message.

  - @return {(Object

    <br />

  - filter a message, return `null`. To transform a message return a map

  - with the following keys:

  -
    - (required) 'data' : {string}
  -
    - (optional) 'attributes' : {Object
  - Returning empty `attributes` will remove all attributes from the

  - message.
    \*

  - @param {(Object

    <br />

  - message. Keys:

  -
    - (required) 'data' : {string}
  -
    - (required) 'attributes' : {Object
  - @param {Object

    <br />

  - Keys:

  -
    - (required) 'message_id' : {string}
  -
    - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
  -
    - (optional) 'ordering_key': {string} \*/

  function

### #function_name

    def function_name() -> ::String

**Returns**

- (::String) --- Required. Name of the JavasScript function that should applied to Pub/Sub messages.

### #function_name=

    def function_name=(value) -> ::String

**Parameter**

- **value** (::String) --- Required. Name of the JavasScript function that should applied to Pub/Sub messages.
**Returns**

- (::String) --- Required. Name of the JavasScript function that should applied to Pub/Sub messages.