Skip to content

Commit 762d837

Browse files
committed
Allow language maps to have a null value, which is ignored.
Related to json-ld/json-ld.org#375.
1 parent b76c51f commit 762d837

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/json/ld/expand.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,13 @@ def expand_object(input, active_property, context, output_object, ordered: false
357357
[value[k]].flatten.each do |item|
358358
# item must be a string, otherwise an invalid language map value error has been detected and processing is aborted.
359359
raise JsonLdError::InvalidLanguageMapValue,
360-
"Expected #{item.inspect} to be a string" unless item.is_a?(String)
360+
"Expected #{item.inspect} to be a string" unless item.nil? || item.is_a?(String)
361361

362362
# Append a JSON object to expanded value that consists of two key-value pairs: (@value-item) and (@language-lowercased language).
363363
ary << {
364364
'@value' => item,
365365
'@language' => k.downcase
366-
}
366+
} if item
367367
end
368368
end
369369

0 commit comments

Comments
 (0)