npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

formalizer

v2.9.0

Published

React hooks based form validation made for humans.

Downloads

102

Readme

Build Status codecov

styled with prettier npm Snyk Vulnerabilities for GitHub Repo GitHub

Formalizer is a React Hooks based form validation library made for humans. The cleanest code or your money back ;)

Installation

yarn add formalizer

or

npm install formalizer --save

Sample Usage

import { useFormalizer } from 'formalizer';

const UserProfileComponent = () => {
  const { formRef, useInput, errors, isValid } = useFormalizer();

  return (
    <form ref={formRef}>
      <input {...useInput('name', ['isRequired'])} />
      <span>{errors['name']}</span>

      <input {...useInput('email', ['isRequired', 'isEmail'])} />
      <span>{errors['email']}</span>

      <button disabled={!isValid} type="submit">
        Submit
      </button>
    </form>
  );
};

For a complete guide on how each of these pieces work, see our tutorial.

In a Nutshell

Use the useFormalizer hook to gain access to the useInput hook, the errors currently in your form, whether the form is valid or not and more.

Then, use the useInput to setup validations on your form inputs.

Formalizer offers two built in validators out-of-the-box and it integrates with the awesome validator library seamlessly, which means if you install it you can use all of their validators.

But know that writing your own custom validators is super easy.

Also, you may create global validators so that they accessible throughout your app. Doing so helps keep your code DRY and facilitates maintaining it.

Finally, if you use Material UI you may like the fact Formalizer integrates with it. If you use some other UI framework, chances are you can tweak our settings to make it work with it.

Contributing

Contributions are very welcome!

We follow the "fork-and-pull" Git workflow.

  1. Create a Fork and clone it

    Simply click on the “fork” button of the repository page on GitHub.

    The standard clone command creates a local git repository from your remote fork on GitHub.

  2. Modify the Code

    In your local clone, modify the code and commit them to your local clone using the git commit command.

    Run yarn test and make sure all tests still pass.

    Run tslint --project . and make sure you get no warnings.

  3. Push your Changes

    Make sure to update affected tests and/or add tests to any new features you may have created.

    We are very careful to make sure coverage does not drop.

  4. Create a Pull Request

    We will review your changes and possibly start a discussion.

    If changes are required, you can simply push these changes into your fork by repeating steps #3 and #4 and the pull request is updated automatically.

License

MIT


Created and maintained by Eduardo Born with ❤ and coffee