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

gitbucket.core.service.PaginationHelper.scala Maven / Gradle / Ivy

The newest version!
package gitbucket.core.service

import scala.util.Try

object PaginationHelper {

  def page(page: Option[String]) = {

    page
      .flatMap(pageStr => Try(pageStr.toInt).toOption)
      .map(Math.max(1, _)) // remove negative pages
      .getOrElse(1)
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy