diff --git a/docs/source/api/utilities/_.md b/docs/source/api/utilities/_.md index c3c66259c0..fe0157a6b1 100644 --- a/docs/source/api/utilities/_.md +++ b/docs/source/api/utilities/_.md @@ -27,19 +27,19 @@ cy._.keys(obj) // Errors, cannot be chained off 'cy' # Examples -## `_.forEach` +## `_.each` ```javascript -// set local reference to lodash -var _ = Cypress._ +// set local reference to lodash and jquery +const { _, $ } = Cypress cy.get("li").then(function($li){ - // use the _.forEach function - _.forEach($li.get(), function(el, i){ + // use the _.each function + _.each($li.get(), function(el, i){ - // use Cypress.$(...) to wrap the DOM element + // use $(...) to wrap the DOM element // into a jQuery object - expect(Cypress.$(el).parent()).to.match("ul") + expect($(el).parent()).to.match("ul") }) }) ``` @@ -49,8 +49,9 @@ cy.get("li").then(function($li){ ```javascript cy // use the _.chain, _.map, _.take, and _.value functions - .request('http://jsonplaceholder.typicode.com/users').then(function(response){ - var ids = Cypress._.chain(response.body).map('id').take(3).value() + .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]) })