{
  "doc": {
    "id": "api/utilities/lodash",
    "title": "Cypress._ | Cypress Documentation",
    "description": "Cypress automatically includes lodash and exposes it as Cypress._.",
    "section": "api",
    "source_path": "/llm/markdown/api/utilities/lodash.md",
    "version": "a8fd16711bdda4c7b5645b9717e588ae99ec2470",
    "updated_at": "2026-05-18T17:21:32.047Z",
    "headings": [
      {
        "id": "api/utilities/lodash#cypress",
        "text": "Cypress._",
        "level": 1
      },
      {
        "id": "api/utilities/lodash#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/utilities/lodash#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/utilities/lodash#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/utilities/lodash#each",
        "text": "_.each",
        "level": 3
      },
      {
        "id": "api/utilities/lodash#chain",
        "text": "_.chain",
        "level": 3
      },
      {
        "id": "api/utilities/lodash#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "content": {
    "type": "root",
    "children": [
      {
        "type": "heading",
        "depth": 1,
        "children": [
          {
            "type": "text",
            "value": "Cypress._"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Cypress automatically includes "
          },
          {
            "type": "link",
            "title": null,
            "url": "https://lodash.com/",
            "children": [
              {
                "type": "text",
                "value": "lodash"
              }
            ]
          },
          {
            "type": "text",
            "value": " and exposes it as `Cypress._`. Call any valid Lodash method on `Cypress._`"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Syntax"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "Cypress._.method()"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "Usage"
          }
        ]
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Correct Usage"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "Cypress._.keys(obj)"
      },
      {
        "type": "paragraph",
        "children": [
          {
            "type": "text",
            "value": "Incorrect Usage"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy._.keys(obj) // Errors, cannot be chained off 'cy'"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "Examples"
          }
        ]
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "`_.each`"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "// set local reference to lodash and jqueryconst { _, $ } = Cypresscy.get('li').then(($li) => {  // use the _.each function  _.each($li.get(), (el, i) => {    // use $(...) to wrap the DOM element    // into a jQuery object    expect($(el).parent()).to.match('ul')  })})"
      },
      {
        "type": "heading",
        "depth": 3,
        "children": [
          {
            "type": "text",
            "value": "`_.chain`"
          }
        ]
      },
      {
        "type": "code",
        "lang": null,
        "meta": null,
        "value": "cy  // use the _.chain, _.map, _.take, and _.value functions  .request('http://jsonplaceholder.typicode.com/users')  .then((response) => {    const ids = Cypress._.chain(response.body).map('id').take(3).value()    expect(ids).to.deep.eq([1, 2, 3])  })"
      },
      {
        "type": "heading",
        "depth": 2,
        "children": [
          {
            "type": "text",
            "value": "See also"
          }
        ]
      },
      {
        "type": "list",
        "ordered": false,
        "start": null,
        "spread": false,
        "children": [
          {
            "type": "listItem",
            "spread": false,
            "checked": null,
            "children": [
              {
                "type": "paragraph",
                "children": [
                  {
                    "type": "link",
                    "title": null,
                    "url": "/llm/markdown/app/references/bundled-libraries.md",
                    "children": [
                      {
                        "type": "text",
                        "value": "Bundled Libraries"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "token_estimate": 161
}