Skip to content

Commit ff65164

Browse files
gkelloggdavidlehn
authored andcommitted
Update based on style comments.
1 parent 9a8c0f2 commit ff65164

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/context.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ api.process = ({activeCtx, localCtx, options}) => {
9696
'Unsupported JSON-LD version: ' + ctx['@version'],
9797
'jsonld.UnsupportedVersion',
9898
{code: 'invalid @version value', context: ctx});
99-
} else if(activeCtx.processingMode && activeCtx.processingMode.indexOf('json-ld-1.1') !== 0) {
99+
}
100+
if(activeCtx.processingMode && activeCtx.processingMode.indexOf('json-ld-1.1') !== 0) {
100101
throw new JsonLdError(
101102
'@version: ' + ctx['@version'] + ' not compatible with ' + activeCtx.processingMode,
102103
'jsonld.ProcessingModeConflict',
@@ -107,7 +108,7 @@ api.process = ({activeCtx, localCtx, options}) => {
107108
defined['@version'] = true;
108109
}
109110

110-
// If not set explicitly, set processingMode to "json-ld-1.0"
111+
// if not set explicitly, set processingMode to "json-ld-1.0"
111112
rval.processingMode = rval.processingMode || activeCtx.processingMode || 'json-ld-1.0';
112113

113114
// handle @base
@@ -379,7 +380,7 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
379380
}
380381

381382
if('@container' in value) {
382-
// Normalize container to an array form
383+
// normalize container to an array form
383384
const container = _isString(value['@container']) ? [value['@container']] : (value['@container'] || []);
384385
const validContainers = ['@list', '@set', '@index', '@language'];
385386
let isValid = true;
@@ -393,14 +394,14 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
393394
// check container length
394395
isValid &= container.length <= (hasSet ? 2 : 1);
395396
} else {
396-
// container must be a string which is one of the validContainers
397+
// in JSON-LD 1.0, container must not be an array (it must be a string, which is one of the validContainers)
397398
isValid &= !_isArray(value['@container']);
398399

399400
// check container length
400401
isValid &= container.length <= 1;
401402
}
402403

403-
// Check against valid containers
404+
// check against valid containers
404405
isValid &= container.every(c => validContainers.includes(c));
405406

406407
// @set not allowed with @list

0 commit comments

Comments
 (0)