# core-validation

> core validation

Latest version **1.0.0** (published 2020-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install core-validation
pnpm add core-validation
yarn add core-validation
bun add core-validation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-05-13 |
| First published | 2017-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 250.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Sky Morey |
| Maintainers | grimace1975 |
| Keywords | validation, parse, format, form |

## Links

- npm: https://www.npmjs.com/package/core-validation
- Repository: https://github.com/bclnet/core-validation
- Homepage: https://github.com/bclnet/core-validation#readme
- Issues: https://github.com/bclnet/core-validation/issues
- npm.io page: https://npm.io/package/core-validation

## Dependencies (1)

- [moment](https://npm.io/package/moment.md) ^2.25.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-05-13
- 0.0.21 — 2020-05-12
- 0.0.20 — 2020-04-10
- 0.0.15 — 2018-12-18
- 0.0.14 — 2018-08-01
- 0.0.13 — 2018-07-31
- 0.0.12 — 2018-07-30
- 0.0.11 — 2018-06-27
- 0.0.10 — 2018-06-20
- 0.0.9 — 2018-06-14
- 0.0.8 — 2018-06-14
- 0.0.7 — 2018-06-08
- 0.0.6 — 2018-06-07
- 0.0.5 — 2018-01-18
- 0.0.4 — 2018-01-08
- … 3 more at https://npm.io/package/core-validation/versions

## README

# core-validation
core validation for form state

## Install

```
$ npm install core-validation --save
```

## Example

```javascript
import React from 'react';
import { default as V } from 'core-validation';

const Rules = [
    V.rule('message', 'Message Body', V.required),
];

export default class extends React.Component {
    constructor(props) {
        super(props);
        this.state = {};
    }
    handleInputChange = (e) => {
        // set state
        V(this).runRules({ rules: Rules });
    })
    handleSubmit = (e) => {
        e.preventDefault();
        if (V(this).hasErrors({ rules: Rules })) return;
        // do submit
    }
    render() {
        const v = V(this);
        v.rules = Rules;
        return (
            <div>
                <input error={v.errorFor('message')} label={v.labelFor('message')} value={v.valueFor('message')} onChange={this.handleInputChange} />
                <button onClick={this.handleSubmit}>Submit</button>
            </div>
        );
    }
}
```




### reset
descrition of reset

`export let reset = function ($this);`

### hasErrors
description of hasErrors

`export let hasErrors = function ($this, rules, stateProp);`

---
_Source: https://npm.io/package/core-validation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
