frontend/js/common/entity/attribute_class_names.js
Paulus Schoutsen 912969111f
Move all of hassUtil to JS (#1153)
* Move all of hassUtil to JS

* Fix tests
2018-05-09 21:33:31 -04:00

7 lines
260 B
JavaScript

export default function attributeClassNames(stateObj, attributes) {
if (!stateObj) return '';
return attributes.map(function (attribute) {
return attribute in stateObj.attributes ? 'has-' + attribute : '';
}).filter(attr => attr !== '').join(' ');
}