add data docs

This commit is contained in:
InsanusMokrassar 2020-06-03 20:16:53 +06:00
parent 1f971117bd
commit be33a130d3
1 changed files with 8 additions and 0 deletions

View File

@ -1,4 +1,12 @@
package com.insanusmokrassar.krontab.utils
/**
* @return [min] in case if [this] less than [min]. Otherwise will check that [max] grant than [this] and return [this]
* if so or [max] otherwise
*/
internal fun Int.clamp(min: Int, max: Int): Int = if (this < min) min else if (this > max) max else this
/**
* Wrapper function for [clamp] extension
*/
internal fun Int.clamp(range: IntRange): Int = clamp(range.first, range.last)