1 # A function to eventually replace the old size() function for stdlib
2 # The original size function did not handle Puppets new type capabilities, so this function is a Puppet 4 compatible solution.
4 # Note: from Puppet 6.0.0, the compatible function with the same name in Puppet core
5 # will be used instead of this function.
7 Puppet::Functions.create_function(:length) do
9 param 'Variant[String,Array,Hash]', :value
12 if value.is_a?(String)
14 elsif value.is_a?(Array) || value.is_a?(Hash)