Nevertheless! Party Metaphorically

    @dupkey/validator
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    @dupkey/validator

    Implement different validation libraries with a common response interface.

    Install

    npm install @dupkey/validator
    

    Example

    import { JoiValidator } from '@dupkey/validator';
    import * as Joi from 'joi';
     
    let input = {
      name: 'Ron Burgundy'
    }
     
    let rules = {
      name: Joi.string().min(3).max(45).required()
    };
     
    let validator = new JoiValidator();
     
    if (validator.validate(input, rules) === false) {
      return validator.getErrors());
    }
    ...

    Build the TypeScript and JavaScript versions

    npm run build

    Run the tests

    npm test

    VS Code Debugging

    Create a launch.json file in your .vscode folder with the following:

    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "node",
          "request": "launch",
          "name": "Mocha Tests",
          "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
          "args": [
            "--require", "ts-node/register",
            "-u", "tdd",
            "--timeout", "999999",
            "--colors", "--recursive",
            "${workspaceFolder}/test/**/*.ts"
          ],
          "internalConsoleOptions": "openOnSessionStart"
        }
      ]
    }

    In the debug tab (Ctrl+Shift+D) select "Mocha Tests" from the dropdown and then click "Start Debugging". Results will display in the console on the bottom of the VS Code.

    Install

    npm i @dupkey/validator

    DownloadsWeekly Downloads

    3

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    8.57 kB

    Total Files

    17

    Last publish

    Collaborators

    • nicgene