lib/libs.js
function pad (s, length, delim, pre) {
                    var i, thisLength = s.length;

                    if(!delim) delim = ' ';
                    if(length === 0) return ''; else if(isNaN(parseInt(length, 10))) return s;

                    length = parseInt(length, 10);
                    if(length < thisLength) return !pre ? s.slice(0, length) : s.slice(-length);

                    if(pre) {
                        for(i = 0; i < length - thisLength; i++) s = delim + s;
                    }
                    else {
                        for(i = 0; i < length - thisLength; i++) s += delim;
                    }
                    return s;
                }
function pad (s, length, delim, pre) {
                    var i, thisLength = s.length;

                    if(!delim) delim = ' ';
                    if(length === 0) return ''; else if(isNaN(parseInt(length, 10))) return s;

                    length = parseInt(length, 10);
                    if(length < thisLength) return !pre ? s.slice(0, length) : s.slice(-length);

                    if(pre) {
                        for(i = 0; i < length - thisLength; i++) s = delim + s;
                    }
                    else {
                        for(i = 0; i < length - thisLength; i++) s += delim;
                    }
                    return s;
                }
Pads a string with 'delim' characters to the specified length. If the length is less than the string length,
the string will be truncated.
@param {String} s The string to operate on.
@param {Number} length The length to pad the string to. If less that the length of the string, the string will
be returned. If less than the length of the string, the string will be sliced.
@param {String=} [delim=' '] The character to pad the string with.
@param {Boolean=} [pre=false] If true, the padding will be added to the beginning of the string, otherwise the padding
will be added to the end.
@returns {String} The padded string
@function