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

izumi.idealingua.model.common.PackageTools.scala Maven / Gradle / Ivy

The newest version!
package izumi.idealingua.model.common

object PackageTools {
  def minimize(value: Package, in: Package): Package = {

    val mapping = value
      .map(Option.apply)
      .zipAll(in.map(Option.apply), None, None)
      .map {
        case (l, r) => (l, r, l == r)
      }
    if (mapping.zip(in).forall(_._1._3)) {
      value.takeRight(value.size - in.size)
    } else {
      value
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy