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

react-props-classnames

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-props-classnames - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

33

lib/createPropsTransform.js

@@ -16,4 +16,6 @@ "use strict";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

@@ -28,23 +30,28 @@

var TransformedComponent = function TransformedComponent(_ref) {
var className = _ref.className,
var _ref$className = _ref.className,
className = _ref$className === void 0 ? '' : _ref$className,
children = _ref.children,
otherOrops = _objectWithoutProperties(_ref, ["className", "children"]);
otherProps = _objectWithoutProperties(_ref, ["className", "children"]);
var propsTransform = new _PropsTransform.default(options);
var propsClassName = propsTransform.getClassNameFromProps(otherOrops);
var propsClassName = propsTransform.getClassNameFromProps(otherProps);
var mergedClassName = "".concat(className, " ").concat(propsClassName).trim();
return _react.default.createElement(Component, _extends({
className: mergedClassName
}, otherOrops), children);
var props = _objectSpread({}, otherProps);
if (mergedClassName !== '') {
props.className = mergedClassName;
}
return _react.default.createElement(Component, props, children);
};
TransformedComponent.displayName = "PropsTransformer(".concat(getDisplayName(Component), ")");
TransformedComponent.propTypes = {
TransformedComponent.propTypes = _objectSpread({
children: _propTypes.default.node,
className: _propTypes.default.string
};
TransformedComponent.defaultProps = {
children: '',
className: ''
};
}, Component.propTypes);
TransformedComponent.defaultProps = _objectSpread({
children: ''
}, Component.defaultProps);
return TransformedComponent;

@@ -51,0 +58,0 @@ };

@@ -14,3 +14,3 @@ {

},
"version": "0.2.2",
"version": "0.2.3",
"main": "lib/index.js",

@@ -17,0 +17,0 @@ "files": [

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