4 module Puppet::Parser::Functions
5 newfunction(:max, :type => :rvalue, :doc => <<-DOC
7 **Deprecated:** Returns the highest value of all arguments.
9 Requires at least one argument.
12 The highest value among those passed in
14 > **Note:** **Deprecated** from Puppet 6.0.0, this function has been replaced with a
15 built-in [`lstrip`](https://puppet.com/docs/puppet/latest/function.html#lstrip) function.
19 raise(Puppet::ParseError, 'max(): Wrong number of arguments need at least one') if args.empty?
21 # Sometimes we get numbers as numerics and sometimes as strings.
22 # We try to compare them as numbers when possible
23 return args.max do |a, b|
24 if a.to_s =~ %r{\A-?\d+(.\d+)?\z} && b.to_s =~ %r{\A-?\d+(.\d+)?\z}