<commit_before>Praetorian
==

Praetorian is a structured JSON validator.  It take both a JSON data set and a structure and tells you if anything, whats wrong with it.

Version
--

0.0.2 (in development)

Installation
--
```sh
$ npm install praetorian
```
Schema
--
Example:
```sh
{
    "shield": {
        "required": true
        "validation": {

        }
    },
    "weapon": {
        "required": true
        "type": "array",
        "items": {
            "sword": {
                "validation": {

                }
            },
            "dagger": {
                "required": true
            }
        }
    }
}
```
Notes:
* Type only needs to be specified if it's ARRAY or OBJECT
* Objects have "properties"
* Arrays have "items"
* Validation configuration should be used to ensure any type dependencies are met

Usage
--
```sh
var Praetorian = require( '../index' );
praetorian = new Praetorian();

// pass your data and structure in like this
praetorian.validate( data, structure, function( err, data ) {
    if( err ) {
        console.log( 'check err', err );
        // requirements will tell you for the passed structure
        // how to fulfill the validation
        praetorian.requirements( structure, function( err, data ) {
            if( err ) {
                // console.log( 'requirements err', err );
            } else {
                // console.log( 'requirements success', data );		
            }
        } );
    } else {
        console.log( 'check success', data );
    }
} );
```

Testing
--

To run the test harness do the following:
```sh
cd praetorian
node test/sanity.js
```
License
--
[MIT](http://en.wikipedia.org/wiki/MIT_License "MIT")<commit_msg>readme update<commit_after>Praetorian
==

Praetorian is a structured JSON validator.  It take both a JSON data set and a structure and tells you if anything, whats wrong with it.

Version
--

0.0.2 (in development)

Installation
--
```sh
$ npm install praetorian
```
Schema
--
Example:
```sh
{
    "shield": {
        "required": true
        "validation": {

        }
    },
    "weapon": {
        "required": true
        "type": "array",
        "items": {
            "sword": {
                "validation": {

                }
            },
            "dagger": {
                "required": true
            }
        }
    },
    "helmet": {
        "type": "object",
        "properties": {
            "noseGuard": {
                "required": true
            },
            "chinStrap": {

            }
        }
    }
}
```
Notes:
* Type only needs to be specified if it's ARRAY or OBJECT
* Objects have "properties"
* Arrays have "items"
* Validation configuration should be used to ensure any type dependencies are met

Usage
--
```sh
var Praetorian = require( '../index' );
praetorian = new Praetorian();

// pass your data and structure in like this
praetorian.validate( data, structure, function( err, data ) {
    if( err ) {
        console.log( 'check err', err );
        // requirements will tell you for the passed structure
        // how to fulfill the validation
        praetorian.requirements( structure, function( err, data ) {
            if( err ) {
                // console.log( 'requirements err', err );
            } else {
                // console.log( 'requirements success', data );		
            }
        } );
    } else {
        console.log( 'check success', data );
    }
} );
```

Testing
--

To run the test harness do the following:
```sh
cd praetorian
node test/sanity.js
```
License
--
[MIT](http://en.wikipedia.org/wiki/MIT_License "MIT")
{'fraction_non_alphanumeric': 0.12757087270705947, 'fraction_numerical': 0.0016675931072818232, 'mean_word_length': 1.840568271507498, 'pattern_counts': {'":': 28, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4055714', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1030, 'n_words': 334}