All Downloads are FREE. Search and download functionalities are using the official Maven repository.

caseapp.core.util.Formatter.scala Maven / Gradle / Ivy

package caseapp.core.util

import caseapp.Name

abstract class Formatter[T] {
  def format(t: T): String
}

object Formatter {

  /** Formats option arguments to a given format.
    *
    * Default formatter will format option arguments as `foo-bar`.
    */
  val DefaultNameFormatter: Formatter[Name] = new Formatter[Name] {
    override def format(name: Name): String =
      CaseUtil
        .pascalCaseSplit(name.name.toList)
        .map(_.toLowerCase)
        .mkString("-")
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy