react-curry
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "react-curry", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "react stateless curry", | ||
@@ -21,4 +21,4 @@ "main": "./lib/index.js", | ||
"dependencies": { | ||
"lodash": "^4.17.4", | ||
"react": "^15.4.2" | ||
"lodash": "*", | ||
"react": ">=14.0.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "repository": { |
@@ -12,14 +12,52 @@ inspired by curry in functional programming | ||
## how to use | ||
## use case | ||
when you want write some similar components. | ||
<img style="width: 100px" src="./water.png"/> | ||
<img style="width: 100px" src="./google.png"/> | ||
these component show green border when selected | ||
``` | ||
import React from 'react'; | ||
import curry from 'react-curry'; // just a function | ||
const Div = (props) => <div {...props}/>; | ||
import curry from 'react-curry'; | ||
const GreenDiv = curry(Div, {style: {backgroundColor: 'green'}}); | ||
// component which will show green border when pass selected = true | ||
const GreenBox = ({selected, InnerComponent, innerProps, size}) => ( | ||
<div | ||
style={{ | ||
border: selected ? 'solid 2px #1fbd87' : undefined, | ||
width: size.width, | ||
height: size.height, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center' | ||
}}> | ||
{ | ||
<InnerComponent selected={selected} {...innerProps} /> | ||
} | ||
</div> | ||
); | ||
React.render( | ||
<GreenDiv>Hello world</GreenDiv>, | ||
document.getElementById('root') | ||
); | ||
``` | ||
// Green box with inner text | ||
const TextGreenBox = curry(GreenBox, { | ||
InnerComponent: ({text, selected}) => <p style={{color: selected ? '#1fbd87' : '#666666'}}>{text}</p>, | ||
size: { | ||
height: '42px', | ||
width: '123px' | ||
} | ||
}); | ||
// Green box with inner img | ||
const ImgGreenBox = curry(GreenBox, { | ||
InnerComponent: ({imgSrc}) => <img src={imgSrc} style={{ width: '100px' }} />,, | ||
size: { | ||
height: '128px', | ||
width: '128px' | ||
} | ||
}); | ||
``` | ||
## dependencies | ||
using lodash merge function, will remove this dependency if stars more than 200 | ||
react | ||
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
42501
8
63
5
2
1
+ Addedreact@19.0.0(transitive)
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedpromise@7.3.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedlodash@*
Updatedreact@>=14.0.0