New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bemto-components

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemto-components - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

5

Changelog.md
## Bemto-components changelog
### v2.1.0 (2018-03-30)
- Added `calculatedProps` to allow props passed inside an object to an element to be calculated when given as functions.
- Fixed some linking issues by deep clone.
### v2.0.3 (2018-03-29)

@@ -4,0 +9,0 @@

30

lib/index.js
const React = require('react');
const PropTypes = require('prop-types');
const cloneDeep = require('lodash.clonedeep');

@@ -131,3 +132,3 @@ // The code below is a mess, I'm sorry. But it is a working mess at least!

const collectOptions = function(tagString, additionalOptions) {
const options = additionalOptions || typeof tagString === 'object' && tagString || {};
const options = cloneDeep(additionalOptions || typeof tagString === 'object' && tagString || {});
const parsedTagString = parseTagString(options.tagString || typeof tagString === 'string' && tagString || '');

@@ -379,13 +380,31 @@ options.type = (typeof tagString === 'function' && React.Component.isPrototypeOf(tagString)) ? 'wrapper' : 'block';

const myPropsProps = item.props || {};
const myPropsProps = cloneDeep(item.props) || {};
// Handle props as functions
for (var key in myPropsProps) {
if (typeof myPropsProps[key] === 'function') {
myPropsProps[key] = {
bemtoCalculated: myPropsProps[key]
}
}
}
if (elemProp && elemProp.props) {
for (var key in elemProp.props) {
myPropsProps[key] = elemProp.props[key];
if (elemProp.calculatedProps && typeof elemProp.props[key] === 'function') {
myPropsProps[key] = {
bemtoCalculated: elemProp.props[key]
};
} else {
myPropsProps[key] = elemProp.props[key];
}
}
}
myPropsProps.key = index;
if (index !== undefined) {
myPropsProps.key = index;
}
// Collecting options from everywhere
const optsItem = collectOptions(item.tagString || '', item);
const optsElem = typeof elemProp === 'object' && collectOptions('', elemProp) || {};
const optsElem = typeof elemProp === 'object' && collectOptions('', cloneDeep(elemProp)) || {};

@@ -411,2 +430,3 @@ const elemOptions = Object.assign(

acceptProps: item.acceptProps,
calculatedProps: item.calculatedProps || (elemProp && elemProp.calculatedProps),
parsedTagString: parsedTagString,

@@ -413,0 +433,0 @@ modifiers: elemOptions.modifiers

9

package.json
{
"name": "bemto-components",
"version": "2.0.3",
"version": "2.1.0",
"description": "Smart components for using parts of BEM methodology with React",

@@ -29,3 +29,4 @@ "main": "lib/index.js",

"dependencies": {
"react": "16.1.1"
"lodash.clonedeep": "^4.5.0",
"react": "16.2.0"
},

@@ -38,5 +39,5 @@ "devDependencies": {

"react-docgen-annotation-resolver": "^1.0.0",
"react-dom": "^16.1.1",
"react-dom": "^16.2.0",
"react-styleguidist": "6.0.33",
"react-test-renderer": "16.1.1",
"react-test-renderer": "16.2.0",
"styled-components": "^3.1.6",

@@ -43,0 +44,0 @@ "webpack": "^3.8.1"

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