From 50f85ad22e23537926bcaf2e753e70dd79aea112 Mon Sep 17 00:00:00 2001 From: Daniel Leite de Oliveira Date: Sun, 10 Apr 2016 09:41:00 -0300 Subject: [PATCH] lint code and test. --- index.js | 10 +++++++--- src/lib/reduce.js | 2 +- src/validate.js | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 4555e6c..52d460d 100644 --- a/index.js +++ b/index.js @@ -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') diff --git a/src/lib/reduce.js b/src/lib/reduce.js index 594d579..76086f6 100644 --- a/src/lib/reduce.js +++ b/src/lib/reduce.js @@ -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]) } diff --git a/src/validate.js b/src/validate.js index 61dca89..3a9f2ad 100644 --- a/src/validate.js +++ b/src/validate.js @@ -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))