function _resizeString(str, size, defaultChar) {
    if (defaultChar !== undefined) {
      if (typeof defaultChar !== 'string' || defaultChar.length !== 1) {
        throw new TypeError('Single character expected as defaultValue');
      }
    } else {
      defaultChar = ' ';
    }

    if (size.length !== 1) {
      throw new DimensionError(size.length, 1);
    }

    var len = size[0];

    if (typeof len !== 'number' || !isInteger(len)) {
      throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + format(size) + ')');
    }

    if (str.length > len) {
      return str.substring(0, len);
    } else if (str.length < len) {
      var res = str;

      for (var i = 0, ii = len - str.length; i < ii; i++) {
        res += defaultChar;
      }

      return res;
    } else {
      return str;
    }
  }
Resize a string
@param {string} str
@param {number[]} size
@param {string} [defaultChar=' ']
@private