From cf897263fdfcb611d4b68bc5880bfce1f0c515bd Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:21:26 +0300 Subject: [PATCH 1/6] Update extendStringPrototype.js add new 'inverse' property that does not include empty chars --- lib/extendStringPrototype.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/extendStringPrototype.js b/lib/extendStringPrototype.js index 46fd386a..04360ce0 100644 --- a/lib/extendStringPrototype.js +++ b/lib/extendStringPrototype.js @@ -24,7 +24,11 @@ module['exports'] = function() { return colors.zalgo(this); }); - addProperty('zebra', function() { + addProperty('piano', function() { + return colors.piano(this); + }); + + addProperty('zebra', function() { return colors.zebra(this); }); From 98c0b3a386db8532f505e9a48cde6978a8864f26 Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:33:14 +0300 Subject: [PATCH 2/6] Create piano.js --- lib/maps/piano.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 lib/maps/piano.js diff --git a/lib/maps/piano.js b/lib/maps/piano.js new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/lib/maps/piano.js @@ -0,0 +1 @@ + From b1d7d2035b25550a6bb5da79eb439886316b854f Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:33:54 +0300 Subject: [PATCH 3/6] Update piano.js --- lib/maps/piano.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/maps/piano.js b/lib/maps/piano.js index 8b137891..fa736235 100644 --- a/lib/maps/piano.js +++ b/lib/maps/piano.js @@ -1 +1,5 @@ - +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; +}; From 69958f5fab996975048493bc1010e9af1934c7be Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:38:31 +0300 Subject: [PATCH 4/6] Update zebra.js --- lib/maps/zebra.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/maps/zebra.js b/lib/maps/zebra.js index fa736235..b3ee6f16 100644 --- a/lib/maps/zebra.js +++ b/lib/maps/zebra.js @@ -1,5 +1,6 @@ module['exports'] = function(colors) { return function(letter, i, exploded) { + if(letter === ' ') return letter; return i % 2 === 0 ? letter : colors.inverse(letter); }; }; From 5b1de3a947fc31eef7dfe8489b42fa8174c379c8 Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 22:39:50 +0300 Subject: [PATCH 5/6] Update colors.js --- lib/colors.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/colors.js b/lib/colors.js index 9c7f1d14..caa92748 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -197,6 +197,7 @@ colors.zalgo = require('./custom/zalgo'); colors.maps = {}; colors.maps.america = require('./maps/america')(colors); colors.maps.zebra = require('./maps/zebra')(colors); +colors.maps.piano = require('./maps/piano')(colors); colors.maps.rainbow = require('./maps/rainbow')(colors); colors.maps.random = require('./maps/random')(colors); From 7ff956b638134e28486545b51aeaac54fd40dec8 Mon Sep 17 00:00:00 2001 From: tyah <50081893+gumbol@users.noreply.github.com> Date: Thu, 9 Sep 2021 23:18:11 +0300 Subject: [PATCH 6/6] Update zebra.js --- lib/maps/zebra.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/maps/zebra.js b/lib/maps/zebra.js index b3ee6f16..60b9ba3d 100644 --- a/lib/maps/zebra.js +++ b/lib/maps/zebra.js @@ -1,6 +1,7 @@ -module['exports'] = function(colors) { - return function(letter, i, exploded) { - if(letter === ' ') return letter; - return i % 2 === 0 ? letter : colors.inverse(letter); +module.exports = (colors) => { + let count = 0; + return function(letter, i, chars) { + if(letter === ' ') {return letter;} + else if(count % 2 === 0) {count++; return colors.inverse(letter); + }else {count++; return letter;} }; }; -};