Revert "Always stringify properties in all array filters (#1936)"

This reverts commit aa1640035f.
This commit is contained in:
Marco Concetto Rudilosso
2025-04-14 11:17:46 +02:00
parent dbe709c3bf
commit 4c07ff920b
2 changed files with 1 additions and 12 deletions
-11
View File
@@ -386,7 +386,6 @@ module Liquid
end
elsif ary.all? { |el| el.respond_to?(:[]) }
begin
property = Utils.to_s(property)
ary.sort { |a, b| nil_safe_compare(a[property], b[property]) }
rescue TypeError
raise_property_error(property)
@@ -416,7 +415,6 @@ module Liquid
end
elsif ary.all? { |el| el.respond_to?(:[]) }
begin
property = Utils.to_s(property)
ary.sort { |a, b| nil_safe_casecmp(a[property], b[property]) }
rescue TypeError
raise_property_error(property)
@@ -504,7 +502,6 @@ module Liquid
elsif ary.empty? # The next two cases assume a non-empty array.
[]
else
property = Utils.to_s(property)
ary.uniq do |item|
item[property]
rescue TypeError
@@ -536,11 +533,6 @@ module Liquid
# @liquid_syntax array | map: string
# @liquid_return [array[untyped]]
def map(input, property)
property = Utils.to_s(property)
# Return the input array if property is empty (no-op)
return InputIterator.new(input, context).to_a if property.empty?
InputIterator.new(input, context).map do |e|
e = e.call if e.is_a?(Proc)
@@ -570,7 +562,6 @@ module Liquid
elsif ary.empty? # The next two cases assume a non-empty array.
[]
else
property = Liquid::Utils.to_s(property)
ary.reject do |item|
item[property].nil?
rescue TypeError
@@ -960,8 +951,6 @@ module Liquid
# @liquid_syntax array | sum
# @liquid_return [number]
def sum(input, property = nil)
property = property.nil? ? nil : Utils.to_s(property)
ary = InputIterator.new(input, context)
return 0 if ary.empty?
+1 -1
View File
@@ -2,5 +2,5 @@
# frozen_string_literal: true
module Liquid
VERSION = "5.8.4"
VERSION = "5.8.5"
end