Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-break-newlines
Advanced tools
Break a string to lines at newlines, and either wrap each line by a configurable wrapper or append a `` to each line.
Break a string to lines at newlines, and either wrap each line by a configurable
wrapper or append a <br />
to each line.
npm install react-break-newlines
import breakNewlines from 'react-break-newlines';
// The string to break.
var str = 'paragraphs\nwith\nnewlines';
// Case 1: Break without a wrapper.
breakNewlines( str );
// Gives [
// paragraphs<br key="0">,
// with<br key="1">,
// newlines<br key="2">
// ]
// Case 2: Break with a <p> wrapper.
breakNewlines( str, 'p' ); // Or breakNewlines( str, <p /> );
// Both give
// [
// <p key="0">paragraphs</p>,
// <p key="1">with</p>,
// <p key="2">newlines</p>
// ]
// Case 3: Break with a wrapper made of a React component.
const Wrapper = props => <div>Wrapper { props.children }</div>;
breakNewlines( str, Wrapper ); // Or breakNewlines( str, <Wrapper /> );
// Both give
// [
// <Wrapper key="0"><div>Wrapper paragraphs</div></Wrapper>,
// <Wrapper key="1"><div>Wrapper with</div></Wrapper>,
// <Wrapper key="2"><div>Wrapper newlines</div></Wrapper>
// ]
MIT. See LICENSE.md for details.
FAQs
Break a string to lines at newlines, and either wrap each line by a configurable wrapper or append a `` to each line.
The npm package react-break-newlines receives a total of 1 weekly downloads. As such, react-break-newlines popularity was classified as not popular.
We found that react-break-newlines 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.