Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,36 @@
var _ = require("underscore");
// Curried mixin function
// Utility Methods
_.mixin({
checkAToZ: function(s) {
return function(letter) {
if (s.indexOf(letter) != -1) { return true};
}
}
});
_.mixin({
toLower: function(str) {
return str.toLowerCase();
}
});
_.mixin({
isPangram: function(lstr) {
var letters = "zqxjkvbpygfwmucldrhsnioate".split('');
return _.every(letters, _.checkAToZ(lstr));
}
});
var panGramStr = "The quick brown fox jumps over the lazy dog";
var IsPanGram = function(panGramStr) {
return _.chain(panGramStr).toLower().isPangram().value();
};
console.log("Result IsPanGram - \"", panGramStr,"\" - " , IsPanGram.call(this,panGramStr));
console.log("Result IsPanGram - \"", "the World","\" - ", IsPanGram.call(this, "the World"));
// Result IsPanGram - " The quick brown fox jumps over the lazy dog " - true
// Result IsPanGram - " the World " - false