Can't you add "===" to the switch node?

Any plans to add "===" for exact match in switch node?
The purpose can be achieved by using two switch nodes or using a function node, but I thought it would be smarter to include it in the switch node.

Now I am using Node-red3.0.2 and NJ18.4.0.

Welcome to the forum @mitubato

I am interested in what use case you have that would benefit from that?

Hello @Colin
We intend to use it to check input values.

The reason we chose not to include that is because for a low-code programming tool, explaining the difference between == and === is not that simple to do.

We could add something like is exactly which is a bit more accessible.

4 Likes

I wondered why you need === rather than ==.

You could check for 'is type of' ? Or matches regex with a pattern

The difficulty of expression is something I also thought of when I looked at the code.

I am at a loss to answer the question of necessity, but I thought it might be useful if it were available.
I think it makes sense to use toString() or parseInt() to determine the type.

It can be done with just one node by setting the rule to JSONata exp and using a rule of the form

($type(payload) = "string") and (payload = "foobar")

1 Like

ありがとう。
参考にさせていただきます。

1 Like