
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@prototyp/skeleform
Advanced tools
Form management and validation toolkit originally a part of https://github.com/prototypdigital/skeletor
Handle form value updates and validation with useForm. Full TypeScript support, ability to configure optional parameters, custom validation rules.
Flexible in its function, supports multiple validation approaches through callbacks:
update("prop", value, true)validate("prop")validateForm()The order of importance when it comes to validating fields is:
true, otherwise it is false;false for values such as: null | undefined | NaN | "" | Invalid Date. This will return true if you have a complex value type such as object | Array, so in case you have a complex value type use a custom validation rule to get what you need.const {state, validation, update, validate} = useForm({email: "", password: "");
...
<input
...
value={state.email}
onChange={(e) => update("email", e.currentTarget.value)}
onBlur={() => validate("email")}
/>
...
// See example 1
...
onChange={(e) => update("email", e.currentTarget.value, true)}
...
// See example 1
function submit() {
if(!validateForm()) {
// Throw invalid error
// validation object will be populated
}
}
...
<input
...
value={state.email}
onUpdate={(e) => update("email", e.currentTarget.value)}
/>
<button onPress={submit}>Submit</button>
Validation has three possible values:
undefined = validation of the field value has not been done yet.false = validation has failed, the state value is not considered valid.true = validation has succeeded, the state value is considered valid.What does that mean? Well, it means that when you have validation.email === false, you should show an error message on the field. undefined | true are not relevant for rendering, only functionally to block form submit events.
const { state, validation, update, validate } = useForm(
{ firstName: "", middleName: "", lastName: ""},
{
// If left empty, validation.middleName will be true
optional: ["middleName"],
// validation.lastName is invalid if lastName is <3 characters long
// state can be used to compare with other values (ie repeat password)
rules: { lastName: (value, state, optional) => value.length >= 3,
}
Utility functions to help with standalone state validation, such as when re-validating a list of form values in a parent components.
const { stateValidation } = useFormUtils<Person>();
function validatePeople() {
return people.every(person => stateValidation(person).valid);
}
Other utilities: doesValueExist, validateByRule, isOptional, fieldValidation, stateValidation. Some are meant for internal useForm usage, such as fieldValidation and validateByRule, but are not unusable.
FAQs
React/React-Native form management utility
We found that @prototyp/skeleform demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.