Skip to content

Instantly share code, notes, and snippets.

@ErnestasJa
Created July 7, 2015 09:42
Show Gist options
  • Save ErnestasJa/91ddea478b501d30c4aa to your computer and use it in GitHub Desktop.
Save ErnestasJa/91ddea478b501d30c4aa to your computer and use it in GitHub Desktop.
var fmt = function () {
var append = function(text,append){
if($.isArray(text))
for(var i = 0; i < text.length; i++)
text[i] = text[i] + append;
else
text = text + append;
return text;
},
split = function (text, separator) {
if (!separator) separator=".";
text = text.split(separator);
for(var i = 0; i < text.length-1; i++)
text[i] = text[i]+ separator;
return text;
},
warning = function (text,class) {
if(!class) class="red"
return '<span class="' + class + '">' + text + '</span>';
},
join = function (tokens){
return tokens.join("");
};
return {
append: append,
split: split,
warning: warning,
join: join
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment