smalley

Validates data passed in against a validation definition config.

Usage no npm install needed!

<script type="module">
  import smalley from 'https://cdn.skypack.dev/smalley';
</script>

README

Smalley

To give your data a checkup from the neckup, and affirmation that your data is valid, it's got everything it needs and, doggone it, people will like it!

Steps to run:

  1. Download/clone the module and put into your node_modules folder
  2. npm run install
  3. Test to make sure everything is loaded correctly: npm run test
  4. Go!

Examples

look for example definition files in the test/customerDefs or test/eventDefs folders

Example Definitions

{
    "firstName": {
        "type": "[object String]",
        "require": true,
        "minLength": 3,
        "maxLength": 15
    },
    "email" : {
        "type": "[object String]",
        "require": true,
        "match": "[a-zA-Z0-9_]+@\\.[a-zA-Z0-9_]{2,4}"
    }
    .
    .
    .
}

Example run

var smalley = require('smalley')
var testData = \{data: \{your object to test}, definitionPath: \'path/to/your/defs\'}
smalley.validate(testData, function(err, res) {
    if(err) 
        ...do something with your err
    else
        ...do something with success message and enjoy life	
});