<commit_before># Jedi Validate
A lightweight form validation component.

[![NPM](https://nodei.co/npm/jedi-validate.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/jedi-validate/)

## How Can I Use It?

This is a JS class, and you can create a new instance by passing in a DOM element and an options object.

```javascript
    new JediValidate(formWrapper, options);
```

By default, the form will be sent via ajax with the parameters which were set in HTML.

## Why Should I Use It?

Because it provides a strict json format for interaction. You can send a form in many different ways:

* serialized
* as a JSON object
* as FormData.

But server answer always have one structure. It is easy to implement. 

## Options

There are three types of option:

* Default component options;
* Form attributes such as action or method;
* Initialization options.

### Default options

```javascript
    {
        ajax: {
            url: null,
            enctype: 'application/x-www-form-urlencoded',
            sendType: 'serialize', // 'formData', 'json'
            method: 'GET'
        },
        rules: {},
        messages: {},
        containers: {
            parent: 'form-group',
            message: 'help-block',
            baseMessage: 'base-error'
        },
        states: {
            error: 'error',
            valid: 'valid',
            pristine: 'pristine',
            dirty: 'dirty'
        },
        callbacks: {
            success: function () {
            },
            error: function () {
            }
        },
        clean: true,
        redirect: true
    }
```

### ajax

Via the ajax option we define how to send the form.
It can be ```null``` if we do not want the form to be sent.
Or it can be an object with the following options;

#### url
default: ```null```
Can be overridden by the `action` form attribute or init options.

#### enctype
default: ```'application/x-www-form-urlencoded'```
Can be overridden by the `enctype` form attribute, init options, or `sendType`.
<commit_msg>Fixed minor typo in README.md<commit_after># Jedi Validate
A lightweight form validation component.

[![NPM](https://nodei.co/npm/jedi-validate.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/jedi-validate/)

## How Can I Use It?

This is a JS class, and you can create a new instance by passing in a DOM element and an options object.

```javascript
    new JediValidate(formWrapper, options);
```

By default, the form will be sent via ajax with the parameters which were set in HTML.

## Why Should I Use It?

Because it provides a strict json format for interaction. You can send a form in many different ways:

* serialized
* as a JSON object
* as FormData.

But server answer always have one structure. It is easy to implement. 

## Options

There are three types of option:

* Default component options;
* Form attributes such as action or method;
* Initialization options.

### Default options

```javascript
    {
        ajax: {
            url: null,
            enctype: 'application/x-www-form-urlencoded',
            sendType: 'serialize', // 'formData', 'json'
            method: 'GET'
        },
        rules: {},
        messages: {},
        containers: {
            parent: 'form-group',
            message: 'help-block',
            baseMessage: 'base-error'
        },
        states: {
            error: 'error',
            valid: 'valid',
            pristine: 'pristine',
            dirty: 'dirty'
        },
        callbacks: {
            success: function () {
            },
            error: function () {
            }
        },
        clean: true,
        redirect: true
    }
```

### ajax

Via the ajax option we define how to send the form.
It can be ```null``` if we do not want the form to be sent.
Or it can be an object with the following options:

#### url
default: ```null```
Can be overridden by the `action` form attribute or init options.

#### enctype
default: ```'application/x-www-form-urlencoded'```
Can be overridden by the `enctype` form attribute, init options, or `sendType`.

{'fraction_non_alphanumeric': 0.10978578383641675, 'fraction_numerical': 0.0, 'mean_word_length': 2.384678747940692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2664256', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1132, 'n_words': 452}