Bug with isSimpleValue Part 2

So, just so I’m clear - in my last entry, I demonstrated using lCase on a variable before passing it to isSimpleValue. This “fixed” the issue with the string containing XML. However, this code will throw an error if the variable contains an array or any other non-simple value. That defeats the whole purpose of using isSimpleValue.

You could wrap the call in a try/catch code block, but that turns a simple check into a multi-line workaround.

Another note - I noticed that when you pass the value to a function where the argument type is “string”, it works just fine.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments