Skip to content

Commit 9b47c62

Browse files
gkelloggdavidlehndlongley
committed
Apply suggestions from code review
Co-Authored-By: David I. Lehn <dil@lehn.org> Co-Authored-By: Dave Longley <dlongley@digitalbazaar.com>
1 parent 9580710 commit 9b47c62

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
defaults to `@id`.
1111
- Expanding/compacting type scoped contexts uses context before applying
1212
new versions to look for type scopes.
13-
-
1413

1514
### Changed
1615
- Default processing mode changed to json-ld-1.1. Allows a 1.1 context to be

lib/compact.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ api.compact = async ({
163163
const inputCtx = activeCtx;
164164

165165
// revert to previous context, if there is one,
166-
// and element is not a value object or a node reference
166+
// and element is not a value object or a node reference
167167
if(!_isValue(element) && !_isSubjectReference(element)) {
168168
activeCtx = activeCtx.revertToPreviousContext();
169169
}

lib/context.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ api.process = async ({
6666
}
6767

6868
// override propagate if localCtx has `@propagate`
69-
if(_isObject(ctxs[0]) && '@propagate' in ctxs[0]) {
69+
if(_isObject(ctxs[0]) && typeof ctxs[0]['@propagate'] === 'boolean') {
7070
// Retrieve early, error checking done later
7171
propagate = ctxs[0]['@propagate'];
7272
}
@@ -90,7 +90,7 @@ api.process = async ({
9090
// reset to initial context
9191
if(ctx === null) {
9292
// We can't nullify if there are protected terms and we're
93-
// not processing a property term scoped context
93+
// not allowing overrides (e.g. processing a property term scoped context)
9494
if(!overrideProtected &&
9595
Object.keys(activeCtx.protected).length !== 0) {
9696
const protectedMode = (options && options.protectedMode) || 'error';
@@ -259,7 +259,7 @@ api.process = async ({
259259
}
260260
if(typeof value !== 'boolean') {
261261
throw new JsonLdError(
262-
'Invalid JSON-LD syntax; @propagate must be boolean valued',
262+
'Invalid JSON-LD syntax; @propagate value must be a boolean.',
263263
'jsonld.SyntaxError',
264264
{code: 'invalid @propagate value', context: localCtx});
265265
}
@@ -279,7 +279,8 @@ api.process = async ({
279279
term: key,
280280
defined,
281281
options,
282-
overrideProtected});
282+
overrideProtected
283+
});
283284
}
284285

285286
// cache result

0 commit comments

Comments
 (0)