I found that some tests were not passing when an "empty" document (or document that had no nodes after compacting) compacted. I found that I needed to port over the following code from pyld:
if (options['compactArrays'] and not options['graph'] and
_is_array(compacted)):
# simplify to a single item
if len(compacted) == 1:
compacted = compacted[0]
# simplify to an empty object
elif len(compacted) == 0:
compacted = {}
# always use an array if graph options is on
elif options['graph']:
compacted = JsonLdProcessor.arrayify(compacted)
While the epilogue to the compacting algorithm does mention some other adjustments, I don't think it mentions this. (Unless I am missing something?)
I found that some tests were not passing when an "empty" document (or document that had no nodes after compacting) compacted. I found that I needed to port over the following code from pyld:
While the epilogue to the compacting algorithm does mention some other adjustments, I don't think it mentions this. (Unless I am missing something?)
This exists both in the REC and current draft.