Browse Source

server: Simplify the AddressValidator

bitcoin
Alexis Hernandez 6 years ago
parent
commit
bbe4828a0e
  1. 4
      server/app/com/xsn/explorer/services/validators/AddressValidator.scala

4
server/app/com/xsn/explorer/services/validators/AddressValidator.scala

@ -3,12 +3,10 @@ package com.xsn.explorer.services.validators
import com.alexitc.playsonify.core.ApplicationResult
import com.xsn.explorer.errors.AddressFormatError
import com.xsn.explorer.models.values.Address
import org.scalactic.{One, Or}
class AddressValidator {
def validate(string: String): ApplicationResult[Address] = {
val maybe = Address.from(string)
Or.from(maybe, One(AddressFormatError))
optional(string, AddressFormatError)(Address.from)
}
}

Loading…
Cancel
Save