Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
25 lines
549 B
JavaScript
Executable file
25 lines
549 B
JavaScript
Executable file
/* exported Format */
|
|
'use strict';
|
|
|
|
/**
|
|
* format.js: simple formatters and string utilities.
|
|
*/
|
|
|
|
var Format = {
|
|
|
|
/**
|
|
* Pads a string to the number of characters specified.
|
|
* @param {String} input value to add padding to.
|
|
* @param {Integer} len length to pad to.
|
|
* @param {String} padWith char to pad with (defaults to " ").
|
|
*/
|
|
padLeft: function(input, len, padWith) {
|
|
padWith = padWith || ' ';
|
|
|
|
var pad = len - (input + '').length;
|
|
while (--pad > -1) {
|
|
input = padWith + input;
|
|
}
|
|
return input;
|
|
}
|
|
};
|