Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy-lmao committed May 31, 2024
1 parent 79f3d2a commit 32855b0
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/order_taking/place_order/dto/address.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ pub fn to_address(dto: AddressDto) -> Result(compound_types.Address, String) {
dto.address_line_1
|> string50.create("address_line_1"),
)
use address_line_2 <- try(case dto.address_line_2 {
Some(addr) -> string50.create_option(addr, "address_line_2")
None -> Ok(None)
})
use address_line_3 <- try(case dto.address_line_2 {
Some(addr) -> string50.create_option(addr, "address_line_3")
None -> Ok(None)
})
use address_line_4 <- try(case dto.address_line_2 {
Some(addr) -> string50.create_option(addr, "address_line_4")
None -> Ok(None)
})
use address_line_2 <- try(
dto.address_line_2
|> option.map(fn(addr) { string50.create_option(addr, "address_line_2") })
|> option.unwrap(Ok(None)),
)
use address_line_3 <- try(
dto.address_line_3
|> option.map(fn(addr) { string50.create_option(addr, "address_line_3") })
|> option.unwrap(Ok(None)),
)
use address_line_4 <- try(
dto.address_line_4
|> option.map(fn(addr) { string50.create_option(addr, "address_line_4") })
|> option.unwrap(Ok(None)),
)
use city <- try(dto.city |> string50.create("city"))
use zip_code <- try(dto.zip_code |> zip_code.create("zip_code"))

Expand Down

0 comments on commit 32855b0

Please sign in to comment.