Skip to content

Commit 7a744aa

Browse files
committed
Replace expensive array intersection with cheaper Hash#has_key? calls.
1 parent 0a975c0 commit 7a744aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/json/ld/utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Utils
99
# @return [Boolean]
1010
def node?(value)
1111
value.is_a?(Hash) &&
12-
(value.keys & %w(@value @list @set)).empty? &&
12+
!(value.has_key?('@value') || value.has_key?('@list') || value.has_key?('@set')) &&
1313
(value.length > 1 || !value.has_key?('@id'))
1414
end
1515

0 commit comments

Comments
 (0)