Open getify opened 10 years ago
Yeah, I think you're right. I actually had changed that but I switched it back for some reason (it was stupid, I think I lost that git commit or something). I hate how verbose it is though. But I'm not sure we can let people do the if
check like that, as those kind of things are where many bugs in JS code lie... I'll change it.
+1
Right now the value is
null
, but it seems like this is a troublesome value for false positives. I could quite easily think about sending anull
value through the channel, but the receiving side might errantly consider that a close signal.I think
csp.CLOSED
should be an empty{ }
object. That wayval === csp.CLOSED
type checks would be protected from such false positives.It wouldn't be a falsy value anymore, which could possibly be surprising to some. Thus,
if (!val) ..
checks would "break", but as mentioned, I think those checks are inherently flawed already because of the false positives issue. Indeed, in your documentation, you already acknowledge that=== csp.CLOSED
checks are more appropriate anyway.