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.
email-prop-type
Advanced tools
This package is used to validate if a React Prop value is a valid email.
Currently, there is no email prop type defined by the prop-types
package. While using PropType.string
works, why not be as specific as possible when validating your props?
Additionally, though it's relatively straightforward to create a custom prop type validator, if you need to implement similar prop type checking in multiple packages, you might not want to repeat yourself.
Depends on the isemail
package. While the isemail
package has options to specify various error levels, email-prop-type
implements the highest level of granularity, i.e. a perfectly granular email address.
npm install --save email-prop-type
import React from 'react';
import PropTypes from 'prop-types';
import emailPropType from 'email-prop-type';
// Create a basic Hyperlink Component with a mailto href value
const Hyperlink = props => (
<a href={`${mailto:props.emailAddress}`>{props.text}</a>
);
Hyperlink.propTypes = {
text: PropTypes.string.isRequired,
emailAddress: emailPropType.isRequired, // can also specify emailPropType if it is not required
};
I didn't see many alternatives:
airbnb/prop-types
project has email validation.react-validator-prop-types
library but if you just want email validation, it might be too heavyweight.FAQs
React Email Prop Type
The npm package email-prop-type receives a total of 15,517 weekly downloads. As such, email-prop-type popularity was classified as popular.
We found that email-prop-type 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.