summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorDavid Schmitt <david.schmitt@puppetlabs.com>2016-01-04 15:35:42 +0000
committerDavid Schmitt <david.schmitt@puppetlabs.com>2016-01-04 15:35:42 +0000
commit9cce93054aaeafeddf38fa48d22d5f123b94adff (patch)
treeda4c94980a3cd6fb31974fea5aa9bda1ed099370 /README.markdown
parent0073c6d8de4fa0a042e82287c8a1e9603601a57b (diff)
parent27782242bc27dced7bed316a01c21fffd94e34f8 (diff)
Merge pull request #545 from mpolenchuk/master
Add clamp function
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 a6ed1fb..3150e44 100644
--- a/README.markdown
+++ b/README.markdown
@@ -193,6 +193,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: