minor rearrangement

This commit is contained in:
Payas Relekar 2024-03-24 06:59:53 +05:30
parent ae378e8351
commit 134486743f

View file

@ -3,7 +3,7 @@ import gleam/dict.{type Dict}
import gleam/list import gleam/list
import gleam/string import gleam/string
import gleam/pair import gleam/pair
import gleam/regex.{type Match, Options} import gleam/regex
pub type Mail { pub type Mail {
Mail(headers: Dict(String, String), body: String) Mail(headers: Dict(String, String), body: String)
@ -84,11 +84,11 @@ fn get_header_dict(s: String) -> #(String, String) {
fn fix_multiline_values(s: String) -> String { fn fix_multiline_values(s: String) -> String {
let assert Ok(multi_line_value) = let assert Ok(multi_line_value) =
regex.compile(": [^\n]+\n\\s+[^\n]+$", Options(True, True)) regex.compile(": [^\n]+\n\\s+[^\n]+$", regex.Options(True, True))
s s
|> regex.scan(multi_line_value, _) |> regex.scan(multi_line_value, _)
|> list.map(fn(match: Match) -> String { match.content }) |> list.map(fn(match) { match.content })
|> list.scan(s, remove_dead_space) |> list.scan(s, remove_dead_space)
|> list.first |> list.first
|> result.unwrap(or: "bar") |> result.unwrap(or: "bar")