mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Revert "Always stringify properties in all array filters (#1936)"
This reverts commit aa1640035f.
This commit is contained in:
@@ -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?
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Liquid
|
||||
VERSION = "5.8.4"
|
||||
VERSION = "5.8.5"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user