Why do split() and indexOf() treat qualityOf() differently - indexOf() requires toStr()

Why does split(qualityOf({value}), "Bad_NotFound”) work but indexOf(qualityOf({value}), "Bad_NotFound”) does not?

why must i use indexOf(toStr(qualityOf({value})), "Bad_NotFound”)?

Example Binding
{
  "type": "tag",
  "config": {
    "mode": "direct",
    "tagPath": "",
    "fallbackDelay": 2.5
  },
  "transforms": [
    {
      "expression": "split(qualityOf({value}), \"Bad_NotFound\")\r\n//indexOf(toStr(qualityOf({value})), \"Bad_NotFound\")\r\n//indexOf(qualityOf({value}), \"Bad_NotFound\")",
      "type": "expression"
    }
  ]
}

Because qualities are objects, not strings. indexOf() can accept a variety of data types, so it doesn't stringify your argument. split() requires a string, so it implicitly applies toStr() for you where necessary.

3 Likes

Suppose the implicit bit is obvious in hindsight. Thanks!

1 Like