@@ -293,7 +293,8 @@ api.createTermDefinition = (
293
293
}
294
294
295
295
// FIXME if(1.1) ... ?
296
- if ( term in activeCtx . protected && ! isPropertyTermScopedContext ) {
296
+ if ( activeCtx . protected . hasOwnProperty ( term ) &&
297
+ ! isPropertyTermScopedContext ) {
297
298
const protectedMode = ( options && options . protectedMode ) || 'error' ;
298
299
if ( protectedMode === 'error' ) {
299
300
throw new JsonLdError (
@@ -435,7 +436,7 @@ api.createTermDefinition = (
435
436
// see if the term has a prefix
436
437
if ( mapping . _termHasColon ) {
437
438
const prefix = term . substr ( 0 , colon ) ;
438
- if ( prefix in localCtx ) {
439
+ if ( localCtx . hasOwnProperty ( prefix ) ) {
439
440
// define parent prefix
440
441
api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
441
442
}
@@ -711,7 +712,7 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
711
712
}
712
713
713
714
// prefix dependency not defined, define it
714
- if ( localCtx && prefix in localCtx ) {
715
+ if ( localCtx && localCtx . hasOwnProperty ( prefix ) ) {
715
716
api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
716
717
}
717
718
@@ -918,7 +919,7 @@ api.getInitialContext = options => {
918
919
* @param typeOrLanguageValue the key in the entry to add to.
919
920
*/
920
921
function _addPreferredTerm ( term , entry , typeOrLanguageValue ) {
921
- if ( ! ( typeOrLanguageValue in entry ) ) {
922
+ if ( ! entry . hasOwnProperty ( typeOrLanguageValue ) ) {
922
923
entry [ typeOrLanguageValue ] = term ;
923
924
}
924
925
}
@@ -974,14 +975,14 @@ api.getContextValue = (ctx, key, type) => {
974
975
// return whole entry
975
976
return entry ;
976
977
}
977
- if ( type in entry ) {
978
+ if ( entry . hasOwnProperty ( type ) ) {
978
979
// return entry value for type
979
980
return entry [ type ] ;
980
981
}
981
982
}
982
983
983
984
// get default language
984
- if ( type === '@language' && ( type in ctx ) ) {
985
+ if ( type === '@language' && ctx . hasOwnProperty ( type ) ) {
985
986
return ctx [ type ] ;
986
987
}
987
988
0 commit comments