UNPKG

450 BJavaScriptView Raw
1'use strict';
2
3/**
4 * Creates a string with the same length as `numSpaces` parameter
5 **/
6exports.indent = function indent(numSpaces) {
7 return new Array(numSpaces+1).join(' ');
8};
9
10/**
11 * Gets the string length of the longer index in a hash
12 **/
13exports.getMaxIndexLength = function(input) {
14 var maxWidth = 0;
15
16 Object.getOwnPropertyNames(input).forEach(function(key) {
17 maxWidth = Math.max(maxWidth, key.length);
18 });
19 return maxWidth;
20};