attrobj
Transforms data-attributes into an array based on key.
Installation
npm install attrobj
Example usage
const attrobj = ;const el = document; const exampleData = ; console;// { name: 'Test Name', color: 'red' }
Global Values
Data can be pulled from window.*
by using data-<somekey>-global-<valuename>
.
Example:
windowrain = '2.1'; const attrobj = ;const el = document; const exampleData = ; console;// { rain: '2,1', cloudy: 'true' }