Fix JS key in object check function

instead of using "in" which could return true for other entries in the
object use the proper hasOwnProperty call
This commit is contained in:
Clemens Schwaighofer
2019-10-16 15:08:08 +09:00
parent f316dde8b7
commit ca073c1b56
2 changed files with 5 additions and 3 deletions

View File

@@ -78,7 +78,7 @@ $cms->DATA['ADMIN'] = $login->acl['admin'];
// the template part to include into the body
$cms->DATA['TEMPLATE_NAME'] = $TEMPLATE_NAME;
$cms->DATA['CONTENT_INCLUDE'] = $CONTENT_INCLUDE;
$cms->DATA['TEMPLATE_TRANSLATE'] = $TEMPLATE_TRANSLATE;
$cms->DATA['TEMPLATE_TRANSLATE'] = isset($TEMPLATE_TRANSLATE) ? $TEMPLATE_TRANSLATE : null;
$cms->DATA['PAGE_FILE_NAME'] = $PAGE_FILE_NAME;
// LANG
$cms->DATA['LANG'] = $lang;

View File

@@ -295,10 +295,12 @@ function isObject(val) {
* @param {Object} object object to search key in
* @return {Boolean} true/false if key exists in object
*/
const keyInObject = (key, object) => (key in object) ? true : false;
// const keyInObject = (key, object) => (key in object) ? true : false;
const keyInObject = (key, object) => (Object.prototype.hasOwnProperty.call(object, key)) ? true : false;
/*function keyInObject(key, object)
{
return (key in object) ? true : false;
// return (key in object) ? true : false;
return (Object.prototype.hasOwnProperty.call(object, key)) ? true : false;
}*/
/**