Closed mapedraza closed 4 weeks ago
This function picks all keys of a certain object and includes the name of the key into an array.
For a given expression like this:
{a:1,b:2,c:3}|valuePicker(1)
The output result will be ["a"]
["a"]
Same for valuePickerMulti, that uses an array with possibles match:
{a:1,b:true,c:'on',d:'nok',e:false,f:0,g:'off',h:'ok'}|valuePickerMulti([true,1,'on','nok'])
The output result will be ["a","b","c","d"]
["a","b","c","d"]
This is util in scenarios in which you need to write into an attribute activated flag or alarms. I.E:
{ "alertA":false, "alertB":true, "alertC":true, }
Then you can have {"alerts":["alertB","alertC"]}
{"alerts":["alertB","alertC"]}
CHANGES_NEXT_RELEASE entry should be added.
Unit test covering the functionality should be added.
Done here: https://github.com/telefonicaid/iotagent-node-lib/pull/1626/commits/12c7d52e51e490eb4f620ee63349a0516dcdb620
This function picks all keys of a certain object and includes the name of the key into an array.
For a given expression like this:
The output result will be
["a"]
Same for valuePickerMulti, that uses an array with possibles match:
The output result will be
["a","b","c","d"]
This is util in scenarios in which you need to write into an attribute activated flag or alarms. I.E:
Then you can have
{"alerts":["alertB","alertC"]}