Created
October 19, 2018 09:21
-
-
Save deepakkadarivel/158fb8eb0dfb6788a2e663d401f270fa to your computer and use it in GitHub Desktop.
Revisions
-
deepakkadarivel created this gist
Oct 19, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ <!DOCTYPE html> <html> <head> <meta name="description" content="[add your bin description]"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Validation logic check.</title> </head> <body> <script id="jsbin-javascript"> function minLength(min, value) { return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; } function minLengthNew(min, value) { return (value && value.toString().length < min) ? 'invalid' : undefined; } console.log(minLength(3, '12')); console.log(minLength(3)); console.log(minLengthNew(3, '12')); console.log(minLengthNew(3)); </script> <script id="jsbin-source-javascript" type="text/javascript">function minLength(min, value) { return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; } function minLengthNew(min, value) { return (value && value.toString().length < min) ? 'invalid' : undefined; } console.log(minLength(3, '12')); console.log(minLength(3)); console.log(minLengthNew(3, '12')); console.log(minLengthNew(3));</script></body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ function minLength(min, value) { return ((value && value.toString().length >= min) || !value) ? undefined : 'invalid'; } function minLengthNew(min, value) { return (value && value.toString().length < min) ? 'invalid' : undefined; } console.log(minLength(3, '12')); console.log(minLength(3)); console.log(minLengthNew(3, '12')); console.log(minLengthNew(3));