Skip to content

Commit 9ebecd4

Browse files
refactor(lib): don't destructure react-property and utilities
1 parent 20981f3 commit 9ebecd4

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/attributes-to-props.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
var reactProperty = require('react-property');
22
var utilities = require('./utilities');
33

4-
var setStyleProp = utilities.setStyleProp;
5-
6-
var htmlProperties = reactProperty.html;
7-
var svgProperties = reactProperty.svg;
8-
var isCustomAttribute = reactProperty.isCustomAttribute;
9-
104
var hasOwnProperty = Object.prototype.hasOwnProperty;
115

126
/**
@@ -28,15 +22,15 @@ function attributesToProps(attributes) {
2822
attributeValue = attributes[attributeName];
2923

3024
// ARIA (aria-*) or custom data (data-*) attribute
31-
if (isCustomAttribute(attributeName)) {
25+
if (reactProperty.isCustomAttribute(attributeName)) {
3226
props[attributeName] = attributeValue;
3327
continue;
3428
}
3529

3630
// convert HTML attribute to React prop
3731
attributeNameLowerCased = attributeName.toLowerCase();
38-
if (hasOwnProperty.call(htmlProperties, attributeNameLowerCased)) {
39-
property = htmlProperties[attributeNameLowerCased];
32+
if (hasOwnProperty.call(reactProperty.html, attributeNameLowerCased)) {
33+
property = reactProperty.html[attributeNameLowerCased];
4034
props[property.propertyName] =
4135
property.hasBooleanValue ||
4236
(property.hasOverloadedBooleanValue && !attributeValue)
@@ -46,8 +40,8 @@ function attributesToProps(attributes) {
4640
}
4741

4842
// convert SVG attribute to React prop
49-
if (hasOwnProperty.call(svgProperties, attributeName)) {
50-
property = svgProperties[attributeName];
43+
if (hasOwnProperty.call(reactProperty.svg, attributeName)) {
44+
property = reactProperty.svg[attributeName];
5145
props[property.propertyName] = attributeValue;
5246
continue;
5347
}
@@ -59,7 +53,7 @@ function attributesToProps(attributes) {
5953
}
6054

6155
// transform inline style to object
62-
setStyleProp(attributes.style, props);
56+
utilities.setStyleProp(attributes.style, props);
6357

6458
return props;
6559
}

0 commit comments

Comments
 (0)