scrape v2.0.0 Scrape.Filter

These functions transform a given list of string results into specific subsets. Very useful to normalize results from Floki.

Summary

Functions

Return a list of all unique strings

Returns the first element of the list

Finds the longest string within an list of strings. If only a string is passed instead of a list, the given string is returned as-is. If nothing can be found, nil is returned

Functions

all(s)
all([String.t] | String.t) :: String.t | nil

Return a list of all unique strings.

## Example

iex> Scrape.Filter.all ["ab", "abc", "abc"]
  ["ab", "abc"]
first(s)
first([String.t] | String.t) :: String.t | nil

Returns the first element of the list.

## Example

iex> Scrape.Filter.first ["ab", "abc", "a"]
  "ab"
longest(s)
longest([String.t] | String.t) :: String.t | nil

Finds the longest string within an list of strings. If only a string is passed instead of a list, the given string is returned as-is. If nothing can be found, nil is returned.

## Example

iex> Scrape.Filter.longest ["abc", "ab", "a"]
  "abc"