Skip to content

Commit

Permalink
Some coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
1602 committed Nov 17, 2011
1 parent 9370a96 commit dd1e54f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
11 changes: 6 additions & 5 deletions lib/validatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ Validatable.validatesNumericalityOf = getConfigurator('numericality');
Validatable.validatesInclusionOf = getConfigurator('inclusion');
Validatable.validatesExclusionOf = getConfigurator('exclusion');
Validatable.validatesFormatOf = getConfigurator('format');
Validatable.validate = function(){
Validatable.validate = function () {
args = [].slice.call(arguments);
var valFn = function(){}; //noop
var valFn = function () {}; // noop
if (typeof args[args.length - 1] === 'function'){
valFn = args.pop();
}
wrapperFn = function(attr, conf, err){ return valFn.call( this, err) };
wrapperFn = function customValidator(attr, conf, err) {
return valFn.call(this, err);
};
configure(this, wrapperFn, args)

}
};

// implementation of validators
var validators = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Anatoliy Chakkaev",
"name": "jugglingdb",
"description": "ORM for every database: redis, mysql, neo4j, mongodb",
"version": "0.0.6",
"version": "0.0.7",
"repository": {
"url": "https://github.com/1602/jugglingdb"
},
Expand Down
5 changes: 2 additions & 3 deletions test/validations_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ it 'should allow to skip validations', (test) ->

test.done()


it 'should throw error on save if required', (test) ->
user = new User

Expand Down Expand Up @@ -216,7 +215,7 @@ it 'should validate format', (test) ->
test.done()

it 'should validate a field using a custom validator', (test)->

User.validate 'email', (err)-> err("crash") if @email.length is 0

user = new User validAttributes
Expand All @@ -227,4 +226,4 @@ it 'should validate a field using a custom validator', (test)->
test.ok not user.isValid()

test.done()

0 comments on commit dd1e54f

Please sign in to comment.