index.js
16 lines
| 1 | export default function getAttribute( name, props, getName = false ) { |
| 2 | const { |
| 3 | attributes, |
| 4 | deviceType, |
| 5 | } = props; |
| 6 | |
| 7 | const device = 'Desktop' === deviceType ? '' : deviceType; |
| 8 | const attributeName = name + device; |
| 9 | |
| 10 | if ( getName ) { |
| 11 | return attributeName; |
| 12 | } |
| 13 | |
| 14 | return attributes[ attributeName ]; |
| 15 | } |
| 16 |