mikeerickson / validatorjs

A data validation library in JavaScript for the browser and Node.js, inspired by Laravel's Validator.
https://www.npmjs.com/package/validatorjs
MIT License
1.77k stars 280 forks source link

"npm install validatejs" installs something very different.. #52

Closed tifidy closed 9 years ago

tifidy commented 9 years ago

I am sort of new to nodejs.. I tried installing this package both global and local and none of them work. So I ended up copying the js file in your /dist folder in github and require it to get it work. But that way I cant get the new commits from you guys. Whats the problem with npm?

By the way I specifically put the keywords on google as "laravel like nodejs validation". You guys came up! awesome job!

garygreen commented 9 years ago

How are you installing and using it with npm? I just tried and it works fine..

npm install validatorjs

Then inside test.js:

var Validator = require('validatorjs');
var v = new Validator({ username: 'blah' }, { username: 'min:15' });
console.log(v.passes(), v.errors.first('username'));

Running it... node test

tifidy commented 9 years ago

Oo wow I made a silly mistake.., pitty of me trying to install "validatejs" instead "validatorjs"..

It all works just fine now. To tell the truth, I started using "laravel" because of its beutiful validation class. Now I can do that in javascript great!