summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorMichael Polenchuk <mpolenchuk@mirantis.com>2015-11-18 14:32:24 +0300
committerMichael Polenchuk <mpolenchuk@mirantis.com>2015-12-31 12:46:07 +0300
commit27782242bc27dced7bed316a01c21fffd94e34f8 (patch)
tree67bd90fde8238bfff754d2fcdd782c9fbc6d88f0 /README.markdown
parent61333cfc48026af204483d681bd8b10cb44d6fc6 (diff)
downloadpuppet-stdlib-27782242bc27dced7bed316a01c21fffd94e34f8.tar.gz
puppet-stdlib-27782242bc27dced7bed316a01c21fffd94e34f8.tar.bz2
Add clamp function
Clamp keeps value within the range. Employ of soft() makes the whole thing is independant of order.
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown8
1 files changed, 8 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 9ff242c..0931e63 100644
--- a/README.markdown
+++ b/README.markdown
@@ -202,6 +202,14 @@ Removes the record separator from the end of a string or an array of strings; fo
Returns a new string with the last character removed. If the string ends with '\r\n', both characters are removed. Applying `chop` to an empty string returns an empty string. If you want to merely remove record separators, then you should use the `chomp` function. Requires a string or an array of strings as input. *Type*: rvalue.
+#### `clamp`
+
+Keeps value within the range [Min, X, Max] by sort based on integer value (order of params doesn't matter). Takes strings, arrays or numerics. Strings are converted and compared numerically. Arrays of values are flattened into a list for further handling. For example:
+ * `clamp('24', [575, 187])` returns 187.
+ * `clamp(16, 88, 661)` returns 88.
+ * `clamp([4, 3, '99'])` returns 4.
+ *Type*: rvalue.
+
#### `concat`
Appends the contents of multiple arrays onto the first array given. For example: