/left-cats

a scala implementation of the left-pad javascript library

Primary LanguageScala

left cats

Join the chat at https://gitter.im/stew/left-cats

A scala implementation of the left-pad javascript library

I was inspired by this article to port this to Scala.

This implementation will let you pad arbitrary F[A] structures with As as long as you have implicit cats.Foldable and cats.Alternative instances.

example usage:

scala> import left.cats._, LeftPad._

scala> LeftPad[String,Char].leftPad("asdf")(10, ' ') 
res0: String = "      asdf"

Of course, it builds in scalaJS as well.