Updating ES6 ... although both the filter and the card may need to be configured.
Object.entries(theObj) returns a representation of the array [[key, value],] of an object that you can work with using the array methods Javascript, .each () ,. any () ,. forEach () ,. filter () ,. map () ,. reduce (), etc.
It saves a lot of work on iterating over parts of an Object.keys(theObj) or Object.values() object separately.
const buttons = { button1: { text: 'Close', onclick: function(){ } }, button2: { text: 'OK', onclick: function(){ } }, button3: { text: 'Cancel', onclick: function(){ } } } list = Object.entries(buttons) .filter(([key, value]) => '${key}'[value] !== 'undefined' )
Tim Pozza Aug 19 '19 at 5:14 2019-08-19 05:14
source share