3 exports.repeat = function (str, num) {
5 for (var i = 0; i < num; i++) { result += str; }
9 exports.arrayEqual = function (a, b) {
10 if (a.length !== b.length) { return false; }
11 for (var i = 0; i < a.length; i++) {
12 if (a[i] !== b[i]) { return false; }
17 exports.trimChars = function (str, chars) {
19 var end = str.length - 1;
20 while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
21 while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
22 return str.slice(start, end + 1);
25 exports.capitalize = function (str) {
26 return str.charAt(0).toUpperCase() + str.slice(1);
29 exports.arrayUnion = function () {
31 for (var i = 0, values = {}; i < arguments.length; i++) {
32 var arr = arguments[i];
33 for (var j = 0; j < arr.length; j++) {
34 if (!values[arr[j]]) {
35 values[arr[j]] = true;
43 function has(obj, key) {
44 return Object.prototype.hasOwnProperty.call(obj, key);
49 exports.extend = function (dest, src) {
51 if (has(src, i)) { dest[i] = src[i]; }
55 exports.trimEnd = function (str) {
56 return str.replace(/\s+$/g, '');