Skip to content

Commit

Permalink
Update .filter function docs.
Browse files Browse the repository at this point in the history
Callback passed to function `filter` get called with 2 arguments (`index` and `element`).
  • Loading branch information
konstantin-popov authored and fb55 committed Apr 2, 2017
1 parent 4d611b7 commit 1dc786b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ $('li').map(function(i, el) {
//=> "apple orange pear"
```

#### .filter( selector ) <br /> .filter( selection ) <br /> .filter( element ) <br /> .filter( function(index) )
#### .filter( selector ) <br /> .filter( selection ) <br /> .filter( element ) <br /> .filter( function(index, element) )

Iterates over a cheerio object, reducing the set of selector elements to those that match the selector or pass the function's test. When a Cheerio selection is specified, return only the elements contained in that selection. When an element is specified, return only that element (if it is contained in the original selection). If using the function method, the function is executed in the context of the selected element, so `this` refers to the current element.

Expand Down

0 comments on commit 1dc786b

Please sign in to comment.