Switch _.isUndefined usage to native versions

Change-type: patch
This commit is contained in:
Pagan Gazzard 2023-10-13 15:16:19 +01:00 committed by Felipe Lalanne
parent 8e23091aa9
commit 3bfdc4454e
2 changed files with 3 additions and 6 deletions

View File

@ -141,10 +141,7 @@ export class SplashImage extends ConfigBackend {
public ensureRequiredConfig(_deviceType: string, conf: ConfigOptions) {
// If the value from the cloud is empty, it is the same as no definition
if (
!_.isUndefined(conf.image) &&
_.isEmpty((conf.image as string).trim())
) {
if (conf.image != null && _.isEmpty((conf.image as string).trim())) {
delete conf.image;
}
return conf;

View File

@ -100,7 +100,7 @@ export function isValidDeviceName(v: unknown): v is DeviceName {
* Ensure a string is either undefined, or a non-empty string
*/
export function validStringOrUndefined(s: string | undefined): boolean {
return _.isUndefined(s) || (typeof s === 'string' && !_.isEmpty(s));
return s == null || (typeof s === 'string' && !_.isEmpty(s));
}
/**
@ -109,5 +109,5 @@ export function validStringOrUndefined(s: string | undefined): boolean {
* Ensure an object is either undefined or an actual object
*/
export function validObjectOrUndefined(o: object | undefined): boolean {
return _.isUndefined(o) || _.isObject(o);
return o == null || _.isObject(o);
}