mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 09:05:13 -07:00
fix ordering of checks
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
require 'cgi'
|
require 'cgi'
|
||||||
require 'base64'
|
require 'base64'
|
||||||
require 'bigdecimal'
|
require 'bigdecimal'
|
||||||
|
|
||||||
module Liquid
|
module Liquid
|
||||||
module StandardFilters
|
module StandardFilters
|
||||||
MAX_I32 = (1 << 31) - 1
|
MAX_I32 = (1 << 31) - 1
|
||||||
@@ -986,15 +985,15 @@ module Liquid
|
|||||||
attr_reader :context
|
attr_reader :context
|
||||||
|
|
||||||
def filter_array(input, property, target_value, default_value = [], &block)
|
def filter_array(input, property, target_value, default_value = [], &block)
|
||||||
|
ary = InputIterator.new(input, context)
|
||||||
|
return default_value if ary.empty?
|
||||||
|
|
||||||
if property.nil?
|
if property.nil?
|
||||||
raise_property_error(property)
|
raise_property_error(property)
|
||||||
end
|
end
|
||||||
|
|
||||||
property = Liquid::Utils.to_s(property)
|
property = Liquid::Utils.to_s(property)
|
||||||
|
|
||||||
ary = InputIterator.new(input, context)
|
|
||||||
return default_value if ary.empty?
|
|
||||||
|
|
||||||
block.call(ary) do |item|
|
block.call(ary) do |item|
|
||||||
if target_value.nil?
|
if target_value.nil?
|
||||||
item[property]
|
item[property]
|
||||||
|
|||||||
Reference in New Issue
Block a user