From dee3ab049407dc77271e0351b2a81f7273827e4e Mon Sep 17 00:00:00 2001 From: zucher Date: Mon, 25 Jun 2018 14:37:45 +0200 Subject: [PATCH] Fix #180 - Custom with multi attr failure Fix #180 - Themes can have multiple attributes - but not in safe mode --- lib/extendStringPrototype.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/extendStringPrototype.js b/lib/extendStringPrototype.js index ed608f6..6d6bbfe 100644 --- a/lib/extendStringPrototype.js +++ b/lib/extendStringPrototype.js @@ -73,18 +73,16 @@ module['exports'] = function() { } else { if (typeof(theme[prop]) === 'string') { colors[prop] = colors[theme[prop]]; - addProperty(prop, function() { - return colors[theme[prop]](this); - }); } else { - addProperty(prop, function() { - var ret = this; - for (var t = 0; t < theme[prop].length; t++) { - ret = colors[theme[prop][t]](ret); - } - return ret; - }); + var tmp = colors[theme[prop][0]]; + for (var t = 1; t < theme[prop].length; t++) { + tmp = tmp[theme[prop][t]]; + } + colors[prop] = tmp; } + addProperty(prop, function() { + return colors[prop](this); + }); } }); }