poppinss / indicative

Indicative is a simple yet powerful data validator for Node.js and browsers. It makes it so simple to write async validations on nested set of data.
https://indicative.adonisjs.com/
MIT License
417 stars 52 forks source link

Above rule always fails when using rule method with 0. #207

Closed erocrizs closed 5 years ago

erocrizs commented 6 years ago

Package version

v5.0.8

Node.js and npm version

node: v8.12.0 npm: 6.4.1

Sample Code (to reproduce the issue)

The above rule always fails when using rule method with 0.

var {rule, validate} = require("indicative")

validate(
    {a: 1000},
    {a:'above:0'}
)
    .then(x => console.log('succes on rule string'))
    .catch(x => console.log('error on rule string'));
// success on rule string

validate(
    {a: 1000},
    {a: [rule('above', 0)]}
)
    .then(x => console.log('succes on rule method'))
    .catch(x => console.log('error on rule method'));
// error on rule method
thetutlage commented 5 years ago

Fixed in newer release https://github.com/poppinss/indicative/releases/tag/v7.2.0