# Snowbridge Script transformation examples
> View example Snowbridge JavaScript transformations for Snowplow and non-Snowplow data including filtering, field modification, and partition keys.
> Source: https://docs.snowplow.io/docs/api-reference/snowbridge/configuration/transformations/custom-scripts/examples/
> Documentation index: https://docs.snowplow.io/llms.txt

Examples showing the transformation of Snowplow or non-Snowplow data.

## Non-Snowplow data

For this example, the input data is a json string which looks like this:

```json
{
  "name": "Bruce",
  "id": "b47m4n",
  "batmobileCount": 1
}
```

The script filters out any data with a `batmobileCount` less than 1, otherwise it updates the Data's `name` field to "Bruce Wayne", and sets the PartitionKey to the value of `id`:

```js
loading...
```

[View on GitHub](<&#xA;https://github.com/snowplow/snowbridge/blob/v6.1.0/assets/docs/configuration/transformations/custom-scripts/examples/js-non-snowplow-script-example.js&#xA;>)

The configuration for this script is:

```hcl
loading...
```

[View on GitHub](<&#xA;https://github.com/snowplow/snowbridge/blob/v6.1.0/assets/docs/configuration/transformations/custom-scripts/examples/js-non-snowplow-config-example.hcl&#xA;>)

## Snowplow data

For this example, the input data is a valid Snowplow TSV event - so we can enable `snowplow_mode`, which will convert the data to a JSON before passing it to the script as a JSON object.

The script below filters out non-web data, based on the `platform` value, otherwise it checks for a `user_id` value, setting a new `uid` field to that value if it's found, or `domain_userid` if not.

It also sets the partitionKey to `app_id`.

```js
loading...
```

[View on GitHub](<&#xA;https://github.com/snowplow/snowbridge/blob/v6.1.0/assets/docs/configuration/transformations/custom-scripts/examples/js-snowplow-script-example.js&#xA;>)

The configuration for this script is:

```hcl
loading...
```

[View on GitHub](<&#xA;https://github.com/snowplow/snowbridge/blob/v6.1.0/assets/docs/configuration/transformations/custom-scripts/examples/js-snowplow-config-example.hcl&#xA;>)
