Skip to content

Commit

Permalink
lint code and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dleitee committed Apr 10, 2016
1 parent 5044902 commit 50f85ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ var isValid = validatejs.isValid

console.time('test')

var result = isValid('Test ValidateJS', [string.minLength(5), string.maxLength(15), util.isRequired]);
console.log(result)
var isvalid = validate(string.maxLength(15), util.isRequired)
var result1 = isvalid('Test ValidateJS')
console.log(result1)

var resultSingleRule = isValid('Test ValidateJS Big String', string.maxLength(15));
var result2 = isValid('Test ValidateJS', [string.minLength(5), string.maxLength(15), util.isRequired])
console.log(result2)

var resultSingleRule = isValid('Test ValidateJS Big String', string.maxLength(15))
console.log(resultSingleRule)

console.timeEnd('test')
2 changes: 1 addition & 1 deletion src/lib/reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/

export const reduce = (func, index, array) => {
if(Array.prototype.reduce) {
if (Array.prototype.reduce) {
return Array.prototype.reduce.apply(array, [func, index])
}

Expand Down
2 changes: 1 addition & 1 deletion src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export const validate =
}

export const isValid =
(v, r=[]) => (validate(...(_isArray(r) ? r : [r]))(v))
(v, r = []) => (validate(...(_isArray(r) ? r : [r]))(v))

0 comments on commit 50f85ad

Please sign in to comment.