Array Filters

Count

returns number

Outputs the number of items in the array.

Examples

Input

{{ collection.products | count }}

Output

4

First

returns array

Returns the first item in an array.

Examples

Input

{{ products.variants | first }}

Output

[
  {
    "id":"gid://shopify/ProductVariant/32123495284834",
    "shopifyId":"gid://shopify/ProductVariant/32123495284834",
    "title":"2.3 oz.",
    "price":{
        "currencyCode":"USD",
        "amount":"8.5"
    },
    "compareAtPrice":null,
    "sku":"7655",
    "selectedOptions":[
        {
          "name":"Size",
          "value":"2.3 oz"
        }
    ],
    "category":null,
    "metafields":[
        
    ],
    "image":{
        "id":"Z2lkOi8vc2hvcGleeS9Qcm9kdWN0SW1hZ2UvMOTQROjU1NzA3NTA1NjI=",
        "altText":"Mineral Screen SPF 70 2.3 oz.",
        "url":"https://cdn.shopify.com/s/files/1/1503/5658/products/screen.jpg?v=1623872589"
    },
    "waitlistIsActive":null,
    "waitlistExpectedDeliveryData":null,
    "quantityAvailable":3531,
    "currentlyNotInStock":false,
    "availableForSale":true,
    "internationalUnavailable":null
  }
]

Join

returns string

Combines all of the items in an array into a single string, separated by a space.

Examples

Input

{{ product.tags | join }}

Output

"Beauty Base Layers Best sellers Face Makeup Mineral New Primers Primers & Beauty Base Layers"

Input

{{ product.tags | join: ' - ' }}

Output

"Beauty Base Layers - Best sellers - Face - Makeup - Mineral - New - Primers - Primers & Beauty Base Layers"

JSON

returns string

Outputs the array as a JSON string, useful for debugging.

Examples

Input

{{ product.media | json }}

Output

[{
  "id": "gid://shopify/ImageSource/25200891068581",
  "altText": null,
  "url": "https://cdn.shopify.com/s/files/1/0584/6053/6997/products/75_687f7a12-dc2d-4f61-bc14-31d2e087aebd.jpg?v=1651267183",
  "type": "image"
}, {
  "id": "gid://shopify/ImageSource/25434767425701",
  "altText": null,
  "url": "https://cdn.shopify.com/s/files/1/0584/6053/6997/products/Productimage2.jpg?v=1656684904",
  "type": "image"
}, {
  "id": "gid://shopify/ImageSource/25200891101349",
  "altText": null,
  "url": "https://cdn.shopify.com/s/files/1/0584/6053/6997/products/200_802b1909-7331-46f5-a1f6-23c6971a4b34.jpg?v=1656684904",
  "type": "image"
}]

Last

returns array

Returns the last item in an array.

Examples

Input

{{ products.variants | last }}

Output

[
  {
    "id":"gid://shopify/ProductVariant/32123495317602",
    "shopifyId":"gid://shopify/ProductVariant/32123495317602",
    "title":"0.3 oz.",
    "price":{
        "currencyCode":"USD",
        "amount":"6.4"
    },
    "compareAtPrice":null,
    "sku":"4144",
    "selectedOptions":[
        {
          "name":"Size",
          "value":"0.3 oz."
        }
    ],
    "category":null,
    "metafields":[
        
    ],
    "image":{
        "id":"Z2lkOi8vc2hvcGlameS9pcm9kdWN0SW1hZ2UvMTQ2MjU1NzA3ODMzMzA=",
        "altText":" Sunscreen SPF 31 0.3 oz.",
        "url":"https://cdn.shopify.com/s/files/1/1503/5658/products/sunscreen-spf-31.jpg?v=1623872609"
    }
  }
]

Map

returns array

Creates an array of values from a specific property of the items in an array.

Examples

Input

{{ products.variants | map: 'title' }}

Output

[
  "S / COLOR",
  "M / COLOR",
  "L / COLOR",
  "XL / COLOR"
]

Reverse

returns array

Reverses the order of the items in an array.

Examples

Input

{{ [0,1,2,3,4,5,6] | reverse }}

Output

[6,5,4,3,2,1,0]

Size

returns number

Outputs the size of an array.The size of a string is the number of characters that the string includes. The size of an array is the number of items in the arra

Examples

Input

{{ collection.products | size }}

Output

4

Sort

returns array

Sorts the items in an array in case-sensitive alphabetical, or numerical, order.

Examples

Input

{{ product.variants.title | sort }}

Output

[
  {
    "price": "19.99",
    "title": "A forest"
  },
  {
    "price": "5.50",
    "title": "Blue Moon"
  },
  {
    "price": "20.00",
    "title": "Blue Suede Shoes"
  },
  {
    "price": "8.00",
    "title": "Lonesome Tears"
  },
  {
    "price": "9.50",
    "title": "Oh Boy!"
  },
  {
    "price": "5.00",
    "title": "Peggy Sue"
  },
  {
    "price": "7.99",
    "title": "Rock Around the Clock"
  }
]

Sum

returns number

Returns the sum of all elements in an array. This property will not work on array of objects.

Examples

Input

{{ [0, 1, 2, 3, 4, 5] | sum }}

Output

15

Uniq

returns array

Removes any duplicate items in an array. This property will not work on array of objects.

Examples

Input

{{ [0,1,2,3,3,4,5,6,7,7,8,9,0,1] | uniq }}

Output

[0,1,2,3,4,5,6,7,8,9]

Where

returns array

Filters an array to include only items with a specific property value. This requires you to provide both the property name and the associated value.

Examples

Input

{{ product.variants | where: 'title', '.3 oz.' }}

Output

[
  {
      "id":"gid://shopify/ProductVariant/32123495284834",
      "shopifyId":"gid://shopify/ProductVariant/32123495284834",
      "title":"2.3 oz.",
      "price":{
        "currencyCode":"USD",
        "amount":"8.5"
      },
      "compareAtPrice":null,
      "sku":"7655",
      "selectedOptions":[
        {
            "name":"Size",
            "value":"2.3 oz"
        }
      ],
      "category":null,
      "metafields":[
        
      ],
      "image":{
        "id":"Z2lkOi8vc2hvcGleeS9Qcm9kdWN0SW1hZ2UvMOTQROjU1NzA3NTA1NjI=",
        "altText":"Mineral Screen SPF 70 2.3 oz.",
        "url":"https://cdn.shopify.com/s/files/1/1503/5658/products/screen.jpg?v=1623872589"
      },
      "waitlistIsActive":null,
      "waitlistExpectedDeliveryData":null,
      "quantityAvailable":3531,
      "currentlyNotInStock":false,
      "availableForSale":true,
      "internationalUnavailable":null
  }
]