Created
November 13, 2021 08:53
-
-
Save seoft/0b348d9ab2d9e7a06801e54602829c80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun from(responseModels: List<ResponseModel>): List<NormalUiModel> { | |
return responseModels.map { from(it) } | |
} | |
fun from(responseModel: ResponseModel): NormalUiModel { | |
return responseModel.run { | |
when (type) { | |
ResponseType.MONITOR -> NormalUiModel.Monitor(id, price, inch ?: 0f) | |
ResponseType.MOUSE -> NormalUiModel.Mouse(id, price, buttonCount ?: 0) | |
ResponseType.PHONE -> NormalUiModel.Phone(id, price, os ?: "") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment