Last active
April 23, 2016 06:35
-
-
Save jonathanwork/c2bdb50adbde13cc992c44333f1360d3 to your computer and use it in GitHub Desktop.
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 characters
function processData(input) { | |
//creator Jonathan R. Lopez | |
var write = function(inputString) { | |
process.stdout.write(inputString); | |
} | |
var test = function() { | |
return 'has test' | |
} | |
var checkingAlphabet = function(result) { | |
//var checkResult = !result ? null : result; | |
hasAlphabet = /([a-z])(?!.*\1)/g; | |
if((result.match(hasAlphabet)).length === 26) { | |
return 'pangram'; | |
} else { | |
return 'not pangram'; | |
} | |
} | |
//this function loop throgh every char | |
var loopingThroughChar = function(a, fn) { | |
var result = ''; | |
for(var i = 0; i <= a.length; i++) { | |
var removeWhiteSpace = /\s/; | |
result += a.toLowerCase().charAt(i).replace(removeWhiteSpace, ''); | |
} | |
//returns a result. | |
var output = fn ? fn(result) : result; | |
write(output); | |
} | |
loopingThroughChar(input,checkingAlphabet); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment