Credo v1.4.0 Credo.Backports.Enum View Source

This module provides functions from the Enum module which are not supported in all Elixir versions supported by Credo.

Link to this section Summary

Functions

Splits the enumerable in two lists according to the given function fun.

Splits the enumerable in two lists according to the given function fun.

Link to this section Functions

Link to this function

chunk_every(list, count, step)

View Source

Splits the enumerable in two lists according to the given function fun.

iex> Credo.Backports.Enum.chunk_every([1, 2, 3, 4, 5, 6], 2, 1)
[[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6]]

Splits the enumerable in two lists according to the given function fun.

iex> Credo.Backports.Enum.split_with([true, false, true, true, false], &(&1))
{[true, true, true], [false, false]}

iex> Credo.Backports.Enum.split_with(["hello", "same", "sample"], &(String.starts_with?(&1, "he")))
{["hello"], ["same", "sample"]}