
Security News
vlt Launches Real-Time Dependency Analysis Powered by Socket
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
data-attrs-to-js
Advanced tools
Parse your [data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) as JavaScript objects.
Parse your data attributes as JavaScript objects.
<div id="dataz"
data-user-name="John"
data-user-id="9"
data-browser="ie6"
data-awesome-colors.red="#ff0000">
</div>
var tojs = require('data-attrs-to-js');
var elem = document.querySelector('dataz');
console.log(tojs(elem));
// {
// browser: 'ie6',
// user: {
// id: '9',
// name: 'John'
// },
// awesome: {
// 'colors.red': '#ff0000'
// }
// }
console.log(
tojs(elem, {
pattern: /^user/
})
);
// {
// user: {
// id: '9',
// name: 'John'
// }
// }
console.log(
tojs(elem, {
separator: '.'
})
);
// {
// 'user-name': 'John',
// 'user-id': '9',
// browser: 'ie6',
// 'awesome-colors': {
// red: '#ff0000'
// }
// }
FAQs
Parse your [data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) as JavaScript objects.
The npm package data-attrs-to-js receives a total of 0 weekly downloads. As such, data-attrs-to-js popularity was classified as not popular.
We found that data-attrs-to-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.