Giter Club home page Giter Club logo

Comments (4)

MarcosRava avatar MarcosRava commented on June 8, 2024

example:

var descriptor = { id: { type: 'integer', required: false },
 name: { type: 'string', min: 3, max: 30 },
 email: 
  { type: 'string',
    min: 7,
    pattern: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ },
 age: { type: 'integer', required: false },
 hands: { type: 'integer', required: false } }

var validator = new schema(descriptor);
validator.validate({name : "Marcos"}, {first : true, single: true}, callback); // error Id
validator.validate({id: 1, name : "Marcos"}, {first : true, single: true}, callback); // ok
validator.validate({id: 1, name : "Marcos"}, callback); // error in all integer fields

from async-validate.

tmpfs avatar tmpfs commented on June 8, 2024

If I understand you correctly I think this was fixed in 4fef115.

Can you confirm please?

from async-validate.

MarcosRava avatar MarcosRava commented on June 8, 2024

Using your latest release, seems it's not working.

Take a look on these tests bellow. The only tests that seems ok is number 2,

var descriptor = {
 name: { type: 'string' },
 age: { type: 'integer', required: false }
 }
var validator = new schema(descriptor);
// 1) error age ; expected null;
validator.validate({age: undefined, name : "Marcos"}, {first : false, single: true}, callback);
// 2) null; expected null;
validator.validate({age: undefined, name : "Marcos"}, {first : true, single: true}, callback);
// 3) null; expected error in age;
validator.validate({age: 'abc', name : "Marcos"}, {first : true, single: true}, callback);

from async-validate.

tmpfs avatar tmpfs commented on June 8, 2024

Thanks for clarifying, I believe 0.1.17 should work as expected.

I need to review all the test cases and add some code coverage:

#12

from async-validate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.