react-hyphen
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -47,22 +47,30 @@ 'use strict'; | ||
language = _ref.language; | ||
return React.Children.toArray(children).map(function (item) { | ||
if (item.type === Hyphenated) { | ||
return item; | ||
} else if (typeof item === 'string') { | ||
return hyphenated.hyphenated(item, { | ||
var childrenCount = React.Children.count(children); | ||
var hyphenateChild = function hyphenateChild(child) { | ||
if (child.type === Hyphenated) { | ||
return child; | ||
} else if (typeof child === 'string') { | ||
return hyphenated.hyphenated(child, { | ||
language: language | ||
}); | ||
} else { | ||
var _item$props = item.props, | ||
_children = _item$props.children, | ||
props = _objectWithoutProperties(_item$props, ["children"]); | ||
var _child$props = child.props, | ||
_children = _child$props.children, | ||
props = _objectWithoutProperties(_child$props, ["children"]); | ||
return _children ? React.cloneElement(item, props, Hyphenated({ | ||
return _children ? React.cloneElement(child, props, Hyphenated({ | ||
children: _children, | ||
language: language | ||
})) : item; | ||
})) : child; | ||
} | ||
}); | ||
}; | ||
if (childrenCount === 1) { | ||
return hyphenateChild(children); | ||
} | ||
return React.Children.map(children, hyphenateChild); | ||
}; | ||
module.exports = Hyphenated; |
{ | ||
"name": "react-hyphen", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "hyphenate", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6763
58