ioBroker / ioBroker.javascript

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

This PR is implementing the another "result" function for the `$` (`selector`) function . #1549

Closed PeterVoronov closed 2 months ago

PeterVoronov commented 2 months ago

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 PR - 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. Changed files:

klein0r commented 2 months ago

Thank you! This could the replace the weird Array.prototype.slice.apply($('0_userdata.0.*')) logic in some Blockly code

PeterVoronov commented 2 months ago

Thank you! This could the replace the weird Array.prototype.slice.apply($('0_userdata.0.*')) logic in some Blockly code

You are always welcome!