I have this function in an AngularJS service:
self.IsValid = function (entity) {
if (entity == undefined || entity == "undefined")
return false;
if (entity == null)
return false;
if (entity == "00000000-0000-0000-0000-000000000000")
return false;
return true;
}
A working sample here.
Is there anything I can do to improve on this? Or maybe there's a better way altogether?
PS: Resharper says that the entity == null
check is always false, but that doesn't feel right, I could have passed null
.