Skip to content

Commit 8411ef3

Browse files
gkelloggdavidlehn
authored andcommitted
Code cleanup.
1 parent 4d6efc7 commit 8411ef3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/context.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ api.process = ({activeCtx, localCtx, options}) => {
9898
'jsonld.UnsupportedVersion',
9999
{code: 'invalid @version value', context: ctx});
100100
}
101-
if(activeCtx.processingMode && activeCtx.processingMode == 'json-ld-1.0') {
101+
if(activeCtx.processingMode && activeCtx.processingMode === 'json-ld-1.0') {
102102
throw new JsonLdError(
103103
'@version: ' + ctx['@version'] + ' not compatible with ' + activeCtx.processingMode,
104104
'jsonld.ProcessingModeConflict',
@@ -334,7 +334,7 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
334334
// indicate if this term may be used as a compact IRI prefix
335335
mapping._prefix = (!mapping._termHasColon &&
336336
id.match(/[:\/\?#\[\]@]$/) &&
337-
(simpleTerm || !activeCtx.processingMode || activeCtx.processingMode == 'json-ld-1.0'));
337+
(simpleTerm || !activeCtx.processingMode || activeCtx.processingMode === 'json-ld-1.0'));
338338
}
339339
}
340340

@@ -866,10 +866,10 @@ api.getAllContexts = async (input, options) => {
866866
* @return boolean.
867867
*/
868868
api.processingMode = (activeCtx, version) => {
869-
if(version.toString() >= "1.1") {
869+
if(version.toString() >= '1.1') {
870870
return activeCtx.processingMode && activeCtx.processingMode >= 'json-ld-' + version.toString();
871871
} else {
872-
return !activeCtx.processingMode || activeCtx.processingMode == 'json-ld-1.0'
872+
return !activeCtx.processingMode || activeCtx.processingMode === 'json-ld-1.0'
873873
}
874874
}
875875

lib/frame.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ api.frame = (state, subjects, frame, parent, property = null) => {
149149
} else {
150150
subframe = frame['@graph'][0];
151151
if(!types.isObject(subframe)) {
152-
subframe == {};
152+
subframe = {};
153153
}
154154
recurse = !(id === '@merged' || id === '@default');
155155
}
156156

157157
if(recurse) {
158-
state.graphStack << state.graph;
158+
state.graphStack.push(state.graph);
159159
state.graph = id;
160160
// recurse into graph
161161
api.frame(state, Object.keys(state.graphMap[id]).sort(), [subframe], output, '@graph');
@@ -398,7 +398,7 @@ function _filterSubject(state, subject, frame, flags) {
398398
for(const key in frame) {
399399
let matchThis = false;
400400
const nodeValues = util.getValues(subject, key);
401-
const isEmpty = util.getValues(frame, key).length == 0;
401+
const isEmpty = util.getValues(frame, key).length === 0;
402402

403403
if(isKeyword(key)) {
404404
// skip non-@id and non-@type
@@ -431,7 +431,7 @@ function _filterSubject(state, subject, frame, flags) {
431431
} else {
432432
// match on a specific @type
433433
for(const type of frame['@type']) {
434-
if(nodeValues.some(tt => tt == type)) {
434+
if(nodeValues.some(tt => tt === type)) {
435435
return true;
436436
}
437437
}

lib/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ api.compareValues = (v1, v2) => {
373373
* @param a the first string.
374374
* @param b the second string.
375375
*
376-
* @return -1 if a < b, 1 if a > b, 0 if a == b.
376+
* @return -1 if a < b, 1 if a > b, 0 if a === b.
377377
*/
378378
api.compareShortestLeast = (a, b) => {
379379
if(a.length < b.length) {

0 commit comments

Comments
 (0)