@@ -293,7 +293,8 @@ api.createTermDefinition = (
293293 }
294294
295295 // FIXME if(1.1) ... ?
296- if ( term in activeCtx . protected && ! isPropertyTermScopedContext ) {
296+ if ( activeCtx . protected . hasOwnProperty ( term ) &&
297+ ! isPropertyTermScopedContext ) {
297298 const protectedMode = ( options && options . protectedMode ) || 'error' ;
298299 if ( protectedMode === 'error' ) {
299300 throw new JsonLdError (
@@ -435,7 +436,7 @@ api.createTermDefinition = (
435436 // see if the term has a prefix
436437 if ( mapping . _termHasColon ) {
437438 const prefix = term . substr ( 0 , colon ) ;
438- if ( prefix in localCtx ) {
439+ if ( localCtx . hasOwnProperty ( prefix ) ) {
439440 // define parent prefix
440441 api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
441442 }
@@ -711,7 +712,7 @@ function _expandIri(activeCtx, value, relativeTo, localCtx, defined, options) {
711712 }
712713
713714 // prefix dependency not defined, define it
714- if ( localCtx && prefix in localCtx ) {
715+ if ( localCtx && localCtx . hasOwnProperty ( prefix ) ) {
715716 api . createTermDefinition ( activeCtx , localCtx , prefix , defined , options ) ;
716717 }
717718
@@ -918,7 +919,7 @@ api.getInitialContext = options => {
918919 * @param typeOrLanguageValue the key in the entry to add to.
919920 */
920921 function _addPreferredTerm ( term , entry , typeOrLanguageValue ) {
921- if ( ! ( typeOrLanguageValue in entry ) ) {
922+ if ( ! entry . hasOwnProperty ( typeOrLanguageValue ) ) {
922923 entry [ typeOrLanguageValue ] = term ;
923924 }
924925 }
@@ -974,14 +975,14 @@ api.getContextValue = (ctx, key, type) => {
974975 // return whole entry
975976 return entry ;
976977 }
977- if ( type in entry ) {
978+ if ( entry . hasOwnProperty ( type ) ) {
978979 // return entry value for type
979980 return entry [ type ] ;
980981 }
981982 }
982983
983984 // get default language
984- if ( type === '@language' && ( type in ctx ) ) {
985+ if ( type === '@language' && ctx . hasOwnProperty ( type ) ) {
985986 return ctx [ type ] ;
986987 }
987988
0 commit comments