> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiwify.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Array filters

> Array filters for working with collections in Liquid templates.

## `first`

Returns the first item of an array.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Ground control to Major Tom." | split: " " | first }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Ground
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %}
    {{ my_array.first }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    zebra
    ```
  </CodeGroup>
</Columns>

You can use `first` with dot notation when you need to use the filter inside a tag:

```liquid theme={null}
{% if my_array.first == "zebra" %}
  Here comes a zebra!
{% endif %}
```

## `last`

Returns the last item of an array.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Ground control to Major Tom." | split: " " | last }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Tom.
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %}
    {{ my_array.last }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    tiger
    ```
  </CodeGroup>
</Columns>

You can use `last` with dot notation when you need to use the filter inside a tag:

```liquid theme={null}
{% if my_array.last == "tiger" %}
  There goes a tiger!
{% endif %}
```

## `join`

Combines the items in an array into a single string using the argument as a separator.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
    {{ beatles | join: " and " }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    John and Paul and George and Ringo
    ```
  </CodeGroup>
</Columns>

## `reverse`

Reverses the order of the items in an array. `reverse` cannot reverse a string.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

    {{ my_array | reverse | join: ", " }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    plums, peaches, oranges, apples
    ```
  </CodeGroup>
</Columns>

Although `reverse` cannot be used directly on a string, you can split a string into an array, reverse the array, and rejoin it by chaining together filters:

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Ground control to Major Tom." | split: "" | reverse | join: "" }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    .moT rojaM ot lortnoc dnuorG
    ```
  </CodeGroup>
</Columns>

## `size`

Returns the number of characters in a string or the number of items in an array.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Ground control to Major Tom." | size }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    28
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

    {{ my_array.size }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    4
    ```
  </CodeGroup>
</Columns>

You can use `size` with dot notation when you need to use the filter inside a tag:

```liquid theme={null}
{% if site.pages.size > 10 %}
  This is a big website!
{% endif %}
```

## `sort`

Sorts items in an array in case-sensitive order.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ", " %}

    {{ my_array | sort | join: ", " }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Sally Snake, giraffe, octopus, zebra
    ```
  </CodeGroup>
</Columns>

An optional argument specifies which property of the array's items to use for sorting.

```liquid theme={null}
{% assign products_by_price = collection.products | sort: "price" %}
{% for product in products_by_price %}
  <h4>{{ product.title }}</h4>
{% endfor %}
```

## `sort_natural`

Sorts items in an array in case-insensitive order.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ", " %}

    {{ my_array | sort_natural | join: ", " }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    giraffe, octopus, Sally Snake, zebra
    ```
  </CodeGroup>
</Columns>

An optional argument specifies which property of the array's items to use for sorting.

```liquid theme={null}
{% assign products_by_company = collection.products | sort_natural: "company" %}
{% for product in products_by_company %}
  <h4>{{ product.title }}</h4>
{% endfor %}
```

## `map`

Creates an array of values by extracting the values of a named property from another object.

In this example, assume the object `site.pages` contains all the metadata for a website. Using `assign` with the `map` filter creates a variable that contains only the values of the `category` properties of everything in the `site.pages` object.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign all_categories = site.pages | map: "category" %}

    {% for item in all_categories %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - business
    - celebrities
    - lifestyle
    - sports
    - technology
    ```
  </CodeGroup>
</Columns>

## `concat`

Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign fruits = "apples, oranges, peaches" | split: ", " %}
    {% assign vegetables = "carrots, turnips, potatoes" | split: ", " %}

    {% assign everything = fruits | concat: vegetables %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - apples
    - oranges
    - peaches
    - carrots
    - turnips
    - potatoes
    ```
  </CodeGroup>
</Columns>

You can string together `concat` filters to join more than two arrays:

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign furniture = "chairs, tables, shelves" | split: ", " %}

    {% assign everything = fruits | concat: vegetables | concat: furniture %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - apples
    - oranges
    - peaches
    - carrots
    - turnips
    - potatoes
    - chairs
    - tables
    - shelves
    ```
  </CodeGroup>
</Columns>

## `uniq`

Removes any duplicate elements in an array.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign my_array = "ants, bugs, bees, bugs, ants" | split: ", " %}
    {{ my_array | uniq | join: ", " }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    ants, bugs, bees
    ```
  </CodeGroup>
</Columns>

## `where`

Creates an array including only the objects with a given property value, or any truthy value by default.

In this example, assume you have a list of products and you want to show your kitchen products separately. Using `where`, you can create an array containing only the products that have a `"type"` of `"kitchen"`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign kitchen_products = products | where: "type", "kitchen" %}

    Kitchen products:
    {% for product in kitchen_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Vacuum
    - Spatula
    - Television
    - Garlic press

    Kitchen products:
    - Spatula
    - Garlic press
    ```
  </CodeGroup>
</Columns>

Say instead you have a list of products and you only want to show those that are available to buy. You can `where` with a property name but no target value to include all products with a truthy `"available"` value.
As a special case, the same will happen if the target value is given but evaluates to `undefined`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign available_products = products | where: "available" %}

    Available products:
    {% for product in available_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Coffee mug
    - Limited edition sneakers
    - Boring sneakers

    Available products:
    - Coffee mug
    - Boring sneakers
    ```
  </CodeGroup>
</Columns>

The `where` filter can also be used to find a single object in an array when combined with the `first` filter. For example, say you want to show off the shirt in your new fall collection.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign new_shirt = products | where: "type", "shirt" | first %}
    Featured product: {{ new_shirt.title }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    Featured product: Hawaiian print sweater vest
    ```
  </CodeGroup>
</Columns>

Additionally, `property` can be any valid Liquid variable expression as used in output syntax, except that the scope of this expression is within each item. For the following `products` array:

```javascript theme={null}
const products = [
    { meta: { details: { class: 'A' } }, order: 1 },
    { meta: { details: { class: 'B' } }, order: 2 },
    { meta: { details: { class: 'B' } }, order: 3 }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign selected = products | where: 'meta.details["class"]', "B" %}
    {% for item in selected -%}
    - {{ item.order }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - 2
    - 3
    ```
  </CodeGroup>
</Columns>

## `slice`

Returns a substring of 1 character beginning at the index specified by the first argument. An optional second argument specifies the length of the substring to be returned.

String indices are numbered starting from 0.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Liquid" | slice: 0 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    L
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Liquid" | slice: 2 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    q
    ```
  </CodeGroup>
</Columns>

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Liquid" | slice: 2, 5 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    quid
    ```
  </CodeGroup>
</Columns>

If the first argument is a negative number, the indices are counted from the end of the string:

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ "Liquid" | slice: -3, 2 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    ui
    ```
  </CodeGroup>
</Columns>

## `where_exp`

Select all the objects in an array where the expression is true. In this example, assume you have a list of products and you want to show your kitchen products separately. Using `where_exp`, you can create an array containing only the products that have a `"type"` of `"kitchen"`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign kitchen_products = products | where_exp: "item", "item.type == 'kitchen'" %}

    Kitchen products:
    {% for product in kitchen_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Vacuum
    - Spatula
    - Television
    - Garlic press

    Kitchen products:
    - Spatula
    - Garlic press
    ```
  </CodeGroup>
</Columns>

## `find`

Return the first object in an array for which the queried attribute has the given value or return `nil` if no item in the array satisfies the given criteria. For the following `members` array:

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | find: "graduation_year", 2014 | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    {"graduation_year":2014,"name":"John"}
    ```
  </CodeGroup>
</Columns>

## `find_exp`

Return the first object in an array for which the given expression evaluates to true or return `nil` if no item in the array satisfies the evaluated expression.

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | find_exp: "item", "item.graduation_year == 2014" | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    {"graduation_year":2014,"name":"John"}
    ```
  </CodeGroup>
</Columns>

## `find_index`

Return the 0-based index of the first object in an array for which the queried attribute has the given value or return `nil` if no item in the array satisfies the given criteria. For the following `members` array:

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | find_index: "graduation_year", 2014 | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    1
    ```
  </CodeGroup>
</Columns>

## `find_index_exp`

Return the 0-based index of the first object in an array for which the given expression evaluates to true or return `nil` if no item in the array satisfies the evaluated expression.

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | find_index_exp: "item", "item.graduation_year == 2014" | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    1
    ```
  </CodeGroup>
</Columns>

## `group_by`

Group an array's items by a given property. For `members` array:

```javascript theme={null}
const members = [
  { graduation_year: 2003, name: 'Jay' },
  { graduation_year: 2003, name: 'John' },
  { graduation_year: 2004, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | group_by: "graduation_year" | json: 2 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    [
      {
        "name": 2003,
        "items": [
          {
            "graduation_year": 2003,
            "name": "Jay"
          },
          {
            "graduation_year": 2003,
            "name": "John"
          }
        ]
      },
      {
        "name": 2004,
        "items": [
          {
            "graduation_year": 2004,
            "name": "Jack"
          }
        ]
      }
    ]
    ```
  </CodeGroup>
</Columns>

## `group_by_exp`

Group an array's items using a Liquid expression. For `members` array below:

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2009, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | group_by_exp: "item", "item.graduation_year | truncate: 3, ''" | json: 2 }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    [
      {
        "name": "201",
        "items": [
          {
            "graduation_year": 2013,
            "name": "Jay"
          },
          {
            "graduation_year": 2014,
            "name": "John"
          }
        ]
      },
      {
        "name": "200",
        "items": [
          {
            "graduation_year": 2009,
            "name": "Jack"
          }
        ]
      }
    ]
    ```
  </CodeGroup>
</Columns>

## `has`

Return `true` if the array includes an item for which the queried attribute has the given value or return `false` if no item in the array satisfies the given criteria. For the following `members` array:

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | has: "graduation_year", 2014 | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    true
    ```
  </CodeGroup>
</Columns>

## `has_exp`

Return `true` if an item exists in an array for which the given expression evaluates to true or return `false` if no item in the array satisfies the evaluated expression.

```javascript theme={null}
const members = [
  { graduation_year: 2013, name: 'Jay' },
  { graduation_year: 2014, name: 'John' },
  { graduation_year: 2014, name: 'Jack' }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {{ members | has_exp: "item", "item.graduation_year == 2014" | json }}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    true
    ```
  </CodeGroup>
</Columns>

## `compact`

Removes any `nil` values from an array.

For this example, assume `site.pages` is an array of content pages for a website, and some of these pages have an attribute called `category` that specifies their content category. If we `map` those categories to an array, some of the array items might be `nil` if any pages do not have a `category` attribute.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign site_categories = site.pages | map: "category" %}

    {% for category in site_categories %}
    - {{ category }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - business
    - celebrities
    -
    - lifestyle
    - sports
    -
    - technology
    ```
  </CodeGroup>
</Columns>

By using `compact` when we create our `site_categories` array, we can remove all the `nil` values in the array.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign site_categories = site.pages | map: "category" | compact %}

    {% for category in site_categories %}
    - {{ category }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - business
    - celebrities
    - lifestyle
    - sports
    - technology
    ```
  </CodeGroup>
</Columns>

## `push`

Push an element into array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign fruits = "apples, oranges" | split: ", " %}

    {% assign everything = fruits | push: "peaches" %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - apples
    - oranges
    - peaches
    ```
  </CodeGroup>
</Columns>

## `pop`

Pop an element from the array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign fruits = "apples, oranges, peaches" | split: ", " %}

    {% assign everything = fruits | pop %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - apples
    - oranges
    ```
  </CodeGroup>
</Columns>

## `shift`

Shift an element from the array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign fruits = "apples, oranges, peaches" | split: ", " %}

    {% assign everything = fruits | shift %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - oranges
    - peaches
    ```
  </CodeGroup>
</Columns>

## `unshift`

Unshift an element to the front of the array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign fruits = "oranges, peaches" | split: ", " %}

    {% assign everything = fruits | unshift: "apples" %}

    {% for item in everything %}
    - {{ item }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - apples
    - oranges
    - peaches
    ```
  </CodeGroup>
</Columns>

## `reject`

Creates an array excluding the objects with a given property value, or excluding truthy values by default when a property is not given.

In this example, assume you have a list of products and you want to filter out kitchen products. Using `reject`, you can create an array excluding only the products that have a `"type"` of `"kitchen"`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign non_kitchen_products = products | reject: "type", "kitchen" %}

    Kitchen products:
    {% for product in non_kitchen_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Vacuum
    - Spatula
    - Television
    - Garlic press

    Kitchen products:
    - Vacuum
    - Television
    ```
  </CodeGroup>
</Columns>

Say instead you have a list of products and you want to exclude taxable products. You can `reject` with a property name but no target value to reject all products with a truthy `"taxable"` value.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign not_taxed_products = products | reject: "taxable" %}

    Available products:
    {% for product in not_taxed_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Vacuum
    - Spatula
    - Television
    - Garlic press

    Available products:
    - Spatula
    - Television
    ```
  </CodeGroup>
</Columns>

Additionally, `property` can be any valid Liquid variable expression as used in output syntax, except that the scope of this expression is within each item. For the following `products` array:

```javascript theme={null}
const products = [
    { meta: { details: { class: 'A' } }, order: 1 },
    { meta: { details: { class: 'B' } }, order: 2 },
    { meta: { details: { class: 'B' } }, order: 3 }
]
```

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    {% assign selected = products | reject: 'meta.details["class"]', "B" %}
    {% for item in selected -%}
    - {{ item.order }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    - 1
    ```
  </CodeGroup>
</Columns>

## `reject_exp`

Select all the objects in an array where the expression is false. In this example, assume you have a list of products and you want to hide your kitchen products. Using `reject_exp`, you can create an array that omits only the products that have a `"type"` of `"kitchen"`.

<Columns cols={2}>
  <CodeGroup>
    ```liquid Code theme={null}
    All products:
    {% for product in products %}
    - {{ product.title }}
    {% endfor %}

    {% assign non_kitchen_products = products | reject_exp: "item", "item.type == 'kitchen'" %}

    Kitchen products:
    {% for product in non_kitchen_products %}
    - {{ product.title }}
    {% endfor %}
    ```
  </CodeGroup>

  <CodeGroup>
    ```liquid Output theme={null}
    All products:
    - Vacuum
    - Spatula
    - Television
    - Garlic press

    Kitchen products:
    - Vacuum
    - Television
    ```
  </CodeGroup>
</Columns>
