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

@artisfy/parse-data-attributes

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

@artisfy/parse-data-attributes - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

24

index.js

@@ -47,4 +47,4 @@ // Parses strings that can have multiple parameters and sub-parameters embedded

function makeParseFunction (attributeName, keyNames) {
return function parseFunction (elem) { // attributesStringattributesString: e.g. "switchName(no-auto, parent) switchName2(auto, parent)"
let attributesString = elem.getAttribute(attributeName);
return function parseFunction (elem) {
let attributesString = elem.getAttribute(attributeName); // e.g. "switchName(no-auto, parent) switchName2(auto, parent)"

@@ -75,2 +75,17 @@ if (!attributesString) {

function parseStringWithIndefiniteNumberOfParams (attributesString) {
if (!attributesString) {
return [];
}
let parsedAttributeValues = parseAttributeString(attributesString); // e.g. [["func1", "1", "2"], ["func2"]]
return parsedAttributeValues.map(function (arrayOfValues) {
return {
funcName: arrayOfValues[0],
args: arrayOfValues.slice(1)
};
});
}
// this parses multiple parameters that *don't* repeat and *don't* have sub-parameters

@@ -105,4 +120,6 @@ function makeSimpleParseFunction (attributeName, keyNames) {

function getAttributeValueAsArray (elem, attributeName) {
// get the value of the attribute
let attributesString = elem.getAttribute(attributeName);
// if it's an empty string or doesn't exist, return an empty array
if (!attributesString) {

@@ -112,4 +129,6 @@ return [];

// trim and replace duplicate spaces
attributesString = formatSpaces(attributesString);
// return an array of the "words" in the string
return attributesString.split(" ");

@@ -126,2 +145,3 @@ }

parseCopyDimensionsAttributes,
parseStringWithIndefiniteNumberOfParams,
formatSpaces,

@@ -128,0 +148,0 @@ getAttributeValueAsArray

2

package.json
{
"name": "@artisfy/parse-data-attributes",
"version": "1.0.0",
"version": "1.0.1",
"description": "Parses strings that can have multiple parameters and sub-parameters embedded",

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

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