Skip to content

Commit

Permalink
ADDED: Helper function 'empty'
Browse files Browse the repository at this point in the history
  • Loading branch information
SagnikGanguly96 committed Dec 14, 2022
1 parent a5b05d0 commit 48d76c4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/js/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,17 @@ function getFormData($form, callback) {
}
}

/**
*
* Determine whether a variable is empty
*
* @param obj Variable to be checked
* @returns {boolean} <b>TRUE</b> if the <i>obj</i> does not exist or has a value that is empty but not equal to <i><b>zero</b></i>, <b>FALSE</b> otherwise.
*/
function empty(obj) {
return (obj !== undefined && obj !== null && obj !== "");
}


window.logStopArt = (stopArt) => logStopArt(stopArt);
window.is_json = (str) => is_json(str);
Expand All @@ -317,6 +328,7 @@ window.numbersOnly = (f, e) => numbersOnly(f, e);
window.readFile = ($el, callback, data, stringify) => readFile($el, callback, data, stringify);
window.mergeFormData = (data, $fileInputs, callback) => mergeFormData(data, $fileInputs, callback);
window.getFormData = ($form, callback) => getFormData($form, callback);
window.empty = (obj) => empty(obj);

$(document).ready(function() {
$.extend({
Expand Down

0 comments on commit 48d76c4

Please sign in to comment.