ioBroker / ioBroker.javascript

Script engine for JavaScript and Blockly
MIT License
320 stars 119 forks source link

[Feature] Implementing the another "result" function for the $ (selector) function #1551

Closed PeterVoronov closed 2 months ago

PeterVoronov commented 2 months ago

Is your feature request related to a problem? Please describe. It's not a problem behind, only small improvement.

Describe the solution you'd like To implement the new "result" function toArray() returns an array of strings which is an usual array with has all selected id's and you can apply all appropriate arrays methods to it. The reason of this - in some cases, you need to get the array of strings from the selector, instead of use the current each iterator. Moreover, the source data already presented as an array of strings, so you don't need to iterate it once more time.

Describe alternatives you've considered Alternative is to call each "result" function to fill an array ... I.e. "internal" array will initially convert to iterator, and then back to array ...

Additional context I think it will be useful. Proposed implementation is in #1549.