Trilium Backend API
    Preparing search index...
    • Iterates over a cheerio object, executing a function for each matched element. When the callback is fired, the function is fired in the context of the DOM element, so this refers to the current element, which is equivalent to the function parameter element. To break out of the each loop early, return with false.

      Type Parameters

      • T

      Parameters

      • this: Cheerio<T>
      • fn: (this: T, i: number, el: T) => boolean | void

        Function to execute.

      Returns Cheerio<T>

      The instance itself, useful for chaining.

      const fruits = [];

      $('li').each(function (i, elem) {
      fruits[i] = $(this).text();
      });

      fruits.join(', ');
      //=> Apple, Orange, Pear