Marwan
01/17/2023, 9:28 AMfunction(value) {
if (value == null || value == "" || typeof value == "undefined") {
return false;
}
return true;
}
CD
01/17/2023, 9:45 AM!!
insteadMarwan
01/17/2023, 10:14 AMNElliott
01/17/2023, 10:20 AMMarwan
01/17/2023, 10:35 AMNElliott
01/17/2023, 10:49 AMCD
01/17/2023, 10:52 AMMarwan
01/17/2023, 11:37 AMbattk
01/17/2023, 2:26 PM0 == ""
is truejen
01/17/2023, 5:11 PMjen
01/17/2023, 5:11 PMjen
01/17/2023, 5:11 PM// Returns true if the passed in thing has a value, false if blank, null, undefined, empty, or 'To Be Generated'.
// We can override whether or not to include blank, undefined, empty, or 'To Be Generated' as null.
function hasValue(value_to_check, options) {
// Set up some default options.
if(options === undefined) {
options = {
check_to_be_generated: true,
check_blank: true,
check_undefined: true,
check_empty_array: true,
check_is_nan: false,
check_null_string: false
}
}
if(options.check_to_be_generated === undefined)
options.check_to_be_generated = true;
if(options.check_blank === undefined)
options.check_blank = true;
if(options.check_undefined === undefined)
options.check_undefined = true;
if(options.check_empty_array === undefined)
options.check_empty_array = true;
if(options.check_is_nan === undefined)
options.check_is_nan = false;
if(options.check_null_string === undefined)
options.check_null_string = false;
// Check if the passed-in-value has a value!
if(value_to_check === null)
return false;
if(options.check_blank && value_to_check === '')
return false;
if(options.check_undefined && value_to_check === undefined)
return false;
if(options.check_to_be_generated && value_to_check == 'To Be Generated')
return false;
if(options.check_empty_array && typeof value_to_check !== 'string' && value_to_check.length == 0)
return false;
if(options.check_is_nan && isNaN(value_to_check))
return false;
if(options.check_null_string && value_to_check === 'null')
return false;
// At this point it passed all the checks so return true.
return true;
}
Marwan
01/17/2023, 6:31 PMif(options.check_to_be_generated && value_to_check == 'To Be Generated')
return false;
Handling NetSuite problems on top of JS problems, I feel your pain 🙂Marwan
01/17/2023, 6:32 PM