Signal drop!
Relay (operand.online) is unreachable.
Usually, a dropped signal means an upgrade is happening. Hold on!
Sorry, no connección.
Hang in there while we get back on track
gram:pain
> ./lib/squish.ex
Lenses
(coming soon!)
defmodule Squish do
def squish([]), do: []
def squish([head | tail]) when is_list(head), do: head ++ squish(tail)
def squish([head | tail]), do: [head] ++ squish(tail)
def pare(text, opts \\ []) do
size = opts[:size] || 50
omission = opts[:omission] || "..."
cond do
not String.valid?(text) -> text
String.length(text) < size -> text
true ->
length_with_omission = size - String.length(omission)
"#{String.slice(text, 0, length_with_omission)}#{omission}"
end
end
end