0

apparently template literals are not supported in the IDE (i get an illegal character warning when I enter the backtick). Is there an alternative? I have the following lengthy expression that I want to include as part of a restdb query:

"_created":{"$gt":{"$date":"$yesterday"}}"

Is there an alternative to painstakingly constructing this as a series of escapes and concatenations? This is what I have right now.

const dateexp = `"_created":{"$gt":{"$date":"$yesterday"}}"`


  if (searchTerm) {
  const regexterm = "\{\"\$regex\": "
  const searchterm = searchTerm


  var q1 = "{\"active\" : true, \"_tags\": " + regexterm + "\"" + searchterm + ", " + dateexp +
"\"}}"
  console.log("q1 is", q1)
Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29

2 Answers2

1

I found a trick that made this considerably easier -- I used the Rhino Online editor at jdoodle.com -- https://www.jdoodle.com/execute-rhino-online/

enter image description here

This sped up the trial & error considerably and I arrived at

var q2 = "{\"active\" : true, \"_tags\": " + regexterm  + "\"" + searchterm  + "\"\}, "  + "\"_created\" : {\"\$gt\" : \{\"\$date\" :\"\$yesterday\"\}\}}" 

A console editor in the Bixby IDE would be great!

PS - it helps to learn that in Rhino there is no console.log, but there is a print().

Fred Zimmerman
  • 1,178
  • 3
  • 13
  • 29
1

This doesn't help you right now, but the Bixby engineering team is hard at work on the "next generation" of javascript runtime environment for capsule code. I can't say much more than this, but rest assured that in the future, you will have a first-class, modern javascript development experience as a bixby capsule developer.

source: I work on the bixby developer tools team.