Skip to content

Commit 58d95cc

Browse files
committed
Refactor hash key test which was allocating too many objects.
1 parent e4f42dd commit 58d95cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/json/ld/expand.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def expand(input, active_property, context, ordered: true)
6262
# If result contains the key @value:
6363
if value?(output_object)
6464
unless (output_object.keys - %w(@value @language @type @index)).empty? &&
65-
(output_object.keys & %w(@language @type)).length < 2
65+
!(output_object.key?('@language') && output_object.key?('@type'))
6666
# The result must not contain any keys other than @value, @language, @type, and @index. It must not contain both the @language key and the @type key. Otherwise, an invalid value object error has been detected and processing is aborted.
6767
raise JsonLdError::InvalidValueObject,
6868
"value object has unknown keys: #{output_object.inspect}"

0 commit comments

Comments
 (0)