View Source Plausible.Stats.Filters (Plausible v0.0.1)
A module for parsing filters used in stat queries.
Summary
Functions
Parses different filter formats.
Functions
Parses different filter formats.
Depending on the format and type of the filters
argument, returns:
- a decoded list, when
filters
is encoded JSON - a parsed filter list, when
filters
is a filter expression string - the same list, when
filters
is a map
Returns an empty list when argument type is unexpected (e.g. nil
).
Examples:
iex> Filters.parse("{\"page\":\"/blog/**\"}")
[[:matches, "event:page", ["/blog/**"]]]
iex> Filters.parse("visit:browser!=Chrome")
[[:is_not, "visit:browser", ["Chrome"]]]
iex> Filters.parse(nil)
[]