Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
react-curry
Advanced tools
inspired by curry in functional programming
because react component always contains only one parameter which is props, my curry function's work is to deep merge props.
npm install --save react-curry
let us make an Original component
when you want write some similar components.
these component show green border when selected
import React from 'react';
import curry from 'react-curry';
// 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>
);
// 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'
}
});
React.render(
<div>
<TextGreenBox selected={true} innerProps={{text: '西瓜'}}/>
<ImgGreenBox selected={true} innerProps={{imgSrc: 'https://www.google.com.hk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'}}/>
</div>,
document.getElementById('root')
)
using lodash merge function, will remove this dependency if stars more than 200 react
FAQs
react stateless component curry
The npm package react-curry receives a total of 21 weekly downloads. As such, react-curry popularity was classified as not popular.
We found that react-curry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.