Add non => function setups for some calls in case

This commit is contained in:
Clemens Schwaighofer
2019-06-05 14:53:33 +09:00
parent 1b45a1b770
commit d44325501a
2 changed files with 32 additions and 2 deletions

View File

@@ -224,6 +224,7 @@ function getTimestamp()
// METHOD: isObject // METHOD: isObject
// PARAMS: possible object // PARAMS: possible object
// RETURN: true/false if it is an object or not // RETURN: true/false if it is an object or not
// DESC : checks if a variable is an object
function isObject(val) { function isObject(val) {
if (val === null) { if (val === null) {
return false; return false;
@@ -231,11 +232,25 @@ function isObject(val) {
return ((typeof val === 'function') || (typeof val === 'object')); return ((typeof val === 'function') || (typeof val === 'object'));
} }
// METHOD: keyInObject
// PARAMS: key name, object
// RETURN: true/false if key exists in object
// DESC : checks if a key exists in a given object
const keyInObject = (key, object) => (key in object) ? true : false;
/*function keyInObject(key, object)
{
return (key in object) ? true : false;
}*/
// METHOD: exists // METHOD: exists
// PARAMS: uid // PARAMS: uid
// RETURN: true/false // RETURN: true/false
// DESC : checks if a DOM element actually exists // DESC : checks if a DOM element actually exists
const exists = (id) => $('#' + id) ? true : false; const exists = (id) => $('#' + id).length > 0 ? true : false;
/*function exists(id)
{
return $('#' + id).length > 0 ? true : false;
}*/
// METHOD: formatBytes // METHOD: formatBytes
// PARAMS: bytes in int // PARAMS: bytes in int

View File

@@ -302,6 +302,7 @@ function getTimestamp()
// METHOD: isObject // METHOD: isObject
// PARAMS: possible object // PARAMS: possible object
// RETURN: true/false if it is an object or not // RETURN: true/false if it is an object or not
// DESC : checks if a variable is an object
function isObject(val) { function isObject(val) {
if (val === null) { if (val === null) {
return false; return false;
@@ -309,11 +310,25 @@ function isObject(val) {
return ((typeof val === 'function') || (typeof val === 'object')); return ((typeof val === 'function') || (typeof val === 'object'));
} }
// METHOD: keyInObject
// PARAMS: key name, object
// RETURN: true/false if key exists in object
// DESC : checks if a key exists in a given object
const keyInObject = (key, object) => (key in object) ? true : false;
/*function keyInObject(key, object)
{
return (key in object) ? true : false;
}*/
// METHOD: exists // METHOD: exists
// PARAMS: uid // PARAMS: uid
// RETURN: true/false // RETURN: true/false
// DESC : checks if a DOM element actually exists // DESC : checks if a DOM element actually exists
const exists = (id) => $(id) ? true : false; const exists = (id) => $('#' + id).length > 0 ? true : false;
/*function exists(id)
{
return $('#' + id).length > 0 ? true : false;
}*/
// METHOD: formatBytes // METHOD: formatBytes
// PARAMS: bytes in int // PARAMS: bytes in int