Mercurial > repo
changeset 4055:4db1b679008d
<mrhmouse> mv raw.php* bin/ello
author | HackBot |
---|---|
date | Fri, 22 Nov 2013 15:51:15 +0000 |
parents | 51fdb6e5b9a8 |
children | 1edabb1df911 |
files | bin/ello raw.php?i=H7Hi3TR2 |
diffstat | 2 files changed, 24 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/ello Fri Nov 22 15:51:04 2013 +0000 +++ b/bin/ello Fri Nov 22 15:51:15 2013 +0000 @@ -1,2 +1,25 @@ #!/usr/bin/env node -var e,l,o,t;t=process.argv[2],(null!=t?t.length:void 0)||(console.log("Usage: ello <name>"),process.exit()),o=/(.*)(e)$/i,e=/(.*)([bcdfghjklmnpqrstvwxz])([o0].*)/i,l=/[bcdfghjklmnpqrstvwxz]/i,console.log(e.test(t)?t.replace(e,function(e,l,o,t){return l+o+"ell"+t}):o.test(t)?t.replace(o,function(e,l){return l+"ello"}):l.test(t)?t+"ello":"Hello, "+t+"!"); \ No newline at end of file + +(function() { + var consonant_then_o, ends_with_consonant, ends_with_e, name; + + name = process.argv[2]; + + if (!(name != null ? name.length : void 0)) { + console.log('Usage: ello <name>'); + process.exit(); + } + + ends_with_e = /(.*)(e)$/i; + + consonant_then_o = /(.*)([bcdfghjklmnpqrstvwxz])([o0].*)/i; + + ends_with_consonant = /[bcdfghjklmnpqrstvwxz]/i; + + console.log(consonant_then_o.test(name) ? name.replace(consonant_then_o, function(match, before, consonant, rest) { + return before + consonant + 'ell' + rest; + }) : ends_with_e.test(name) ? name.replace(ends_with_e, function(match, before) { + return before + 'ello'; + }) : ends_with_consonant.test(name) ? name + 'ello' : "Hello, " + name + "!"); + +}).call(this); \ No newline at end of file
--- a/raw.php?i=H7Hi3TR2 Fri Nov 22 15:51:04 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#!/usr/bin/env node - -(function() { - var consonant_then_o, ends_with_consonant, ends_with_e, name; - - name = process.argv[2]; - - if (!(name != null ? name.length : void 0)) { - console.log('Usage: ello <name>'); - process.exit(); - } - - ends_with_e = /(.*)(e)$/i; - - consonant_then_o = /(.*)([bcdfghjklmnpqrstvwxz])([o0].*)/i; - - ends_with_consonant = /[bcdfghjklmnpqrstvwxz]/i; - - console.log(consonant_then_o.test(name) ? name.replace(consonant_then_o, function(match, before, consonant, rest) { - return before + consonant + 'ell' + rest; - }) : ends_with_e.test(name) ? name.replace(ends_with_e, function(match, before) { - return before + 'ello'; - }) : ends_with_consonant.test(name) ? name + 'ello' : "Hello, " + name + "!"); - -}).call(this); \ No newline at end of file