From 9ebecd45e86ebe07e3a3bc2f28d66a852c1dd177 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 7 Sep 2021 00:28:09 -0400 Subject: [PATCH] refactor(lib): don't destructure react-property and utilities --- lib/attributes-to-props.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/attributes-to-props.js b/lib/attributes-to-props.js index d2e3ff34..e2a52ab4 100644 --- a/lib/attributes-to-props.js +++ b/lib/attributes-to-props.js @@ -1,12 +1,6 @@ var reactProperty = require('react-property'); var utilities = require('./utilities'); -var setStyleProp = utilities.setStyleProp; - -var htmlProperties = reactProperty.html; -var svgProperties = reactProperty.svg; -var isCustomAttribute = reactProperty.isCustomAttribute; - var hasOwnProperty = Object.prototype.hasOwnProperty; /** @@ -28,15 +22,15 @@ function attributesToProps(attributes) { attributeValue = attributes[attributeName]; // ARIA (aria-*) or custom data (data-*) attribute - if (isCustomAttribute(attributeName)) { + if (reactProperty.isCustomAttribute(attributeName)) { props[attributeName] = attributeValue; continue; } // convert HTML attribute to React prop attributeNameLowerCased = attributeName.toLowerCase(); - if (hasOwnProperty.call(htmlProperties, attributeNameLowerCased)) { - property = htmlProperties[attributeNameLowerCased]; + if (hasOwnProperty.call(reactProperty.html, attributeNameLowerCased)) { + property = reactProperty.html[attributeNameLowerCased]; props[property.propertyName] = property.hasBooleanValue || (property.hasOverloadedBooleanValue && !attributeValue) @@ -46,8 +40,8 @@ function attributesToProps(attributes) { } // convert SVG attribute to React prop - if (hasOwnProperty.call(svgProperties, attributeName)) { - property = svgProperties[attributeName]; + if (hasOwnProperty.call(reactProperty.svg, attributeName)) { + property = reactProperty.svg[attributeName]; props[property.propertyName] = attributeValue; continue; } @@ -59,7 +53,7 @@ function attributesToProps(attributes) { } // transform inline style to object - setStyleProp(attributes.style, props); + utilities.setStyleProp(attributes.style, props); return props; }