class JMESPath::Nodes::Map

def call(args)

def call(args)
  if args.count != 2
    return maybe_raise Errors::InvalidArityError, 'function map() expects two arguments'
  end
  if Nodes::Expression === args[0]
    expr = args[0]
  else
    return maybe_raise Errors::InvalidTypeError, 'function map() expects the first argument to be an expression'
  end
  if args[1].respond_to?(:to_ary)
    list = args[1].to_ary
  else
    return maybe_raise Errors::InvalidTypeError, 'function map() expects the second argument to be an list'
  end
  list.map { |value| expr.eval(value) }
end