@@ -382,14 +382,14 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
382
382
if ( '@container' in value ) {
383
383
// normalize container to an array form
384
384
const container = _isString ( value [ '@container' ] ) ? [ value [ '@container' ] ] : ( value [ '@container' ] || [ ] ) ;
385
- const validContainers = new Set ( [ '@list' , '@set' , '@index' , '@language' ] ) ;
385
+ const validContainers = [ '@list' , '@set' , '@index' , '@language' ] ;
386
386
let isValid = true ;
387
387
let hasSet = container . includes ( '@set' ) ;
388
388
389
389
// JSON-LD 1.1 support
390
390
if ( activeCtx . processingMode && activeCtx . processingMode . indexOf ( 'json-ld-1.1' ) === 0 ) {
391
391
// TODO: @id and @type
392
- validContainers . add ( '@graph' ) ;
392
+ validContainers . push ( '@graph' ) ;
393
393
394
394
// check container length
395
395
isValid &= container . length <= ( hasSet ? 2 : 1 ) ;
@@ -402,15 +402,15 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
402
402
}
403
403
404
404
// check against valid containers
405
- isValid &= container . every ( c => validContainers . has ( c ) ) ;
405
+ isValid &= container . every ( c => validContainers . includes ( c ) ) ;
406
406
407
407
// @set not allowed with @list
408
408
isValid &= ! ( hasSet && container . includes ( '@list' ) ) ;
409
409
410
410
if ( ! isValid ) {
411
411
throw new JsonLdError (
412
412
'Invalid JSON-LD syntax; @context @container value must be ' +
413
- 'one of the following: ' + Array . from ( validContainers ) . join ( ', ' ) ,
413
+ 'one of the following: ' + validContainers . join ( ', ' ) ,
414
414
'jsonld.SyntaxError' ,
415
415
{ code : 'invalid container mapping' , context : localCtx } ) ;
416
416
}
0 commit comments