Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-component-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-component-parser - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

10

dist/component.js

@@ -16,10 +16,10 @@ 'use strict';

var options = function options(component) {
var options = function options(node) {
var parseOption = function parseOption(option) {
if (!component.hasAttribute('data-' + (0, _helpers.toSnakeCase)(option))) {
if (!node.hasAttribute('data-' + (0, _helpers.toSnakeCase)(option))) {
if (defaultOptions[option] === 'required') {
throw new Error('Option `' + option + '` is required on component `' + component + '`');
throw new Error('Option `' + option + '` is required on component `' + tag + '`');
}

@@ -30,3 +30,3 @@

var value = component.getAttribute('data-' + (0, _helpers.toSnakeCase)(option));
var value = node.getAttribute('data-' + (0, _helpers.toSnakeCase)(option));

@@ -49,3 +49,3 @@ if (value === '') {

node: node,
options: options(component)
options: options(node)
};

@@ -52,0 +52,0 @@ });

{
"name": "dom-component-parser",
"version": "0.1.0",
"version": "0.1.1",
"description": "Extract nodes and corresponding custom options from the DOM",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -5,10 +5,10 @@ import { keys, toSnakeCase } from './helpers';

const options = component => {
const options = node => {
const parseOption = option => {
if (!component.hasAttribute(`data-${toSnakeCase(option)}`)) {
if (!node.hasAttribute(`data-${toSnakeCase(option)}`)) {
if (defaultOptions[option] === 'required') {
throw new Error(`Option \`${option}\` is required on component \`${component}\``);
throw new Error(`Option \`${option}\` is required on component \`${tag}\``);
}

@@ -19,3 +19,3 @@

const value = component.getAttribute(`data-${toSnakeCase(option)}`);
const value = node.getAttribute(`data-${toSnakeCase(option)}`);

@@ -37,3 +37,3 @@ if (value === '') {

node,
options: options(component),
options: options(node),
}));

@@ -40,0 +40,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc