consul/ui-v2/app/utils/makeAttrable.js

10 lines
187 B
JavaScript

// Used to make an pojo 'attr-able'
// i.e. you can call pojo.attr('key') on it
export default function(obj) {
return {
attr: function(prop) {
return obj[prop];
},
};
}