From aedb7765413181b037b52de1b621b3791e5ac181 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 26 Jun 2014 22:18:49 +0200 Subject: [PATCH] Add more utils functions. --- app/coffee/utils.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/coffee/utils.coffee b/app/coffee/utils.coffee index 4cd8dfa5..04f47f8e 100644 --- a/app/coffee/utils.coffee +++ b/app/coffee/utils.coffee @@ -69,6 +69,22 @@ scopeDefer = (scope, func) -> scope.$apply(func) +toString = (value) -> + if _.isNumber(value) + return value + "" + else if _.isString(value) + return value + else if _.isPlainObject(value) + return JSON.stringify(value) + else if _.isUndefined(value) + return "" + return value.toString() + + +joinStr = (str, coll) -> + return _.str.join(str, coll) + + taiga = @.taiga taiga.bindOnce = bindOnce taiga.mixOf = mixOf @@ -77,3 +93,5 @@ taiga.toggleText = toggleText taiga.groupBy = groupBy taiga.timeout = timeout taiga.scopeDefer = scopeDefer +taiga.toString = toString +taiga.joinStr = joinStr