From f5f2b7156258961e54980636f6fcff3c6e7dbcef Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 1 May 2015 00:33:34 -0700 Subject: [PATCH] refactor helpers. --- lib/widget.js | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index d157739..e04d993 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -9055,34 +9055,6 @@ blend._cache = {}; var helpers = {}; -helpers.generateTags = function(style, text) { - var open = '' - , close = ''; - - Object.keys(style || {}).forEach(function(key) { - var val = style[key]; - if (typeof val === 'string') { - val = val.replace(/^light(?!-)/, 'light-'); - open = '{' + val + '-' + key + '}' + open; - close += '{/' + val + '-' + key + '}'; - } else { - if (val === true) { - open = '{' + key + '}' + open; - close += '{/' + key + '}'; - } - } - }); - - if (text != null) { - return open + text + close; - } - - return { - open: open, - close: close - }; -}; - helpers.merge = function(a, b) { Object.keys(b).forEach(function(key) { a[key] = b[key]; @@ -9163,6 +9135,34 @@ helpers.parseTags = function(text) { { parseTags: true, screen: Screen.global }, text); }; +helpers.generateTags = function(style, text) { + var open = '' + , close = ''; + + Object.keys(style || {}).forEach(function(key) { + var val = style[key]; + if (typeof val === 'string') { + val = val.replace(/^light(?!-)/, 'light-'); + open = '{' + val + '-' + key + '}' + open; + close += '{/' + val + '-' + key + '}'; + } else { + if (val === true) { + open = '{' + key + '}' + open; + close += '{/' + key + '}'; + } + } + }); + + if (text != null) { + return open + text + close; + } + + return { + open: open, + close: close + }; +}; + helpers.attrToBinary = function(style, element) { return Element.prototype.sattr.call(element || {}, style); };