From 1dc786b5078be851728fccbcb8408e39fb351fd6 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 31 Mar 2017 16:19:29 +0300 Subject: [PATCH] Update .filter function docs. Callback passed to function `filter` get called with 2 arguments (`index` and `element`). --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 01b254d020..42aa461ef8 100644 --- a/Readme.md +++ b/Readme.md @@ -505,7 +505,7 @@ $('li').map(function(i, el) { //=> "apple orange pear" ``` -#### .filter( selector )
.filter( selection )
.filter( element )
.filter( function(index) ) +#### .filter( selector )
.filter( selection )
.filter( element )
.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.