2 # **Deprecated:** A function to eventually replace the old size() function for stdlib
4 # The original size() function did not handle Puppets new type capabilities, so this function
5 # is a Puppet 4 compatible solution.
7 # > **Note:** **Deprecated** from Puppet 6.0.0, this function has been replaced with a
8 # built-in [`length`](https://puppet.com/docs/puppet/latest/function.html#length) function.
10 Puppet::Functions.create_function(:length) do
12 # The value whose length is to be found
15 # The length of the given object
17 param 'Variant[String,Array,Hash]', :value
20 if value.is_a?(String)
22 elsif value.is_a?(Array) || value.is_a?(Hash)