attrobj

WebJar for attrobj

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

attrobj
Last Version

Last Version

3.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

attrobj
WebJar for attrobj
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/firstandthird/attrobj

Download attrobj

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/attrobj/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>attrobj</artifactId>
    <version>3.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/attrobj/
implementation 'org.webjars.npm:attrobj:3.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/attrobj/
implementation ("org.webjars.npm:attrobj:3.1.0")
'org.webjars.npm:attrobj:jar:3.1.0'
<dependency org="org.webjars.npm" name="attrobj" rev="3.1.0">
  <artifact name="attrobj" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='attrobj', version='3.1.0')
)
libraryDependencies += "org.webjars.npm" % "attrobj" % "3.1.0"
[org.webjars.npm/attrobj "3.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

attrobj

Build Status npm

Transforms data-attributes into an array based on key.

Installation

npm install attrobj

Example usage

<div id="example" data-example-name="Test Name" data-example-color="red"></div>
const attrobj = require('attrobj');
const el = document.getElementById('example');

const exampleData = attrobj('example', el);

console.log(exampleData);
// { name: 'Test Name', color: 'red' }

Global Values

Data can be pulled from window.* by using data-<somekey>-global-<valuename>.

Example:

<div id="example2" data-weather-global-rain="rain" data-weather-cloudy="true"></div>
window.rain = '2.1';

const attrobj = require('attrobj');
const el = document.getElementById('example2');

const exampleData = attrobj('weather', el);

console.log(exampleData);
// { rain: '2,1', cloudy: 'true' }
org.webjars.npm

First+Third

We build things... awesome things.

Versions

Version
3.1.0