Skip to content

Commit

Permalink
Merge pull request #7 from victor-fdez/fix/precedense-operator
Browse files Browse the repository at this point in the history
Fix Operator Precedence Issue in isKey Method in newer ruby versions
  • Loading branch information
fungiboletus authored Jan 24, 2024
2 parents 3c86c04 + 4ab740f commit f267afd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rodash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ def self.parent(object, path)

def self.isKey(value, object)
return true if value.is_a? Numeric
return !value.is_a?(Array) &&
(@@reIsPlainProp =~ value || !@@reIsDeepProp =~ value ||
(!object.nil? && !object.is_a?(Array) && object.has_key?(value)))

return false if value.is_a?(Array)

@@reIsPlainProp.match?(value) ||
!@@reIsDeepProp.match?(value) ||
(object && !object.is_a?(Array) && object.has_key?(value))
end

def self.baseToPath(value)
Expand Down

0 comments on commit f267afd

Please sign in to comment.