Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
abstract-form
Advanced tools
Readme
Abstract form components for React
npm install abstract-form --save
var {registerInput} = require('abstract-form');
registerInput('date', DateInput);
registerInput('email', EmailInput);
registerInput('text', TextInput);
registerInput('integer', IntegerInput);
class DateInput extends Component {
static validate(value) {
return /^\d\d\d\d\-\d\d\-\d\d$/.test(value);
}
_onChange = (e) => {
this.props.onChange(e.target.value);
}
render() {
return (
<div>
<input type="text" placeholder="yyyy-mm-dd" value={this.props.value} onChange={this._onChange} />
{
this.props.error
? <div>{this.props.error}</div>
: null
}
</div>
);
}
}
function isInteger(value) {
if (typeof value === 'string') {
return /^\d+$/.test(value) && isInteger(+value);
} else if (typeof value === 'number') {
return (value | 0) === value;
}
return false;
}
class IntegerInput extends Component {
static validate(value) {
if (!isInteger(value)) {
return 'Please enter a valid whole number.';
}
}
static normalize(value) {
return +value;
}
_onChange = (e) => {
this.props.onChange(e.target.value);
}
render() {
return (
<div>
<input type="text" value={this.props.value} onChange={this.props.onChange} />
{
this.props.error
? <div>{this.props.error}</div>
: null
}
</div>
);
}
}
import {createForm, Input, SubmitButton} from 'abstract-form';
function maxLength(n) {
return (value) => {
if (value.length > n) {
return `Please enter fewer than ${n} characters.`;
}
};
}
function NewEntry({data, isValid, Form}) {
return (
<Form>
Date: <Input type="date" name="creationDate" required />
Email: <Input type="email" name="userEmail" required />
<Input type="text" name="messageText" required validate={maxLength(100)} />
<SubmitButton disabled={!isValid}>Create Entry</SubmitButton>
</Form>
);
}
const NewEntryContainer = createForm(NewEntry);
import {InputOnBlur} from 'abstract-form';
function DateInputOnBlur(props) {
return <InputOnBlur type="date" value={props.value} onChange={props.onChange} />
}
MIT
FAQs
Abstract form components for React
The npm package abstract-form receives a total of 3 weekly downloads. As such, abstract-form popularity was classified as not popular.
We found that abstract-form 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.