Pad the value of a fixed-length field

@param {String} value
@param {Number} length
@return {String}
164455
function padValue(value, length) {
  assert.strictEqual(typeof value, 'string');
  assert.strictEqual(typeof length, 'number');

  var result = value;

  while (result.length < length) {
    result = '0' + result;
  }

  return result;
}
335915
function (value) {
        let val = parseInt(value, 10);
        if (isNaN(val)) {
            return false;
        }
        return (val + '').length === value.length;
    }
1095279
function pad(str) {
  if (str.length < max) {
    return str + ' '.repeat(max - str.length);
  }
  return str;
}
338434
function _getPadding (source, char, len) {
    if (!isNil(source) && type(source) !== "String") {
        source = String(source);
    }

    return _repeat(String(char)[0] || "", Math.ceil(len - source.length));
}
997666
private static void padInt(StringBuilder buffer, int value, int length) {
        String strValue = Integer.toString(value);
        for (int i = length - strValue.length(); i > 0; i--) {
            buffer.append('0');
        }
        buffer.append(strValue);
    }
1028778
function padding(size,ch){
    var str = '';
    if(!ch && ch !== 0){
        ch = ' ';
    }
    while(size !== 0){
        if(size & 1 === 1){
            str += ch;
        }
        ch += ch;
        size >>>= 1;
    }
    return str;
}
1288165
function pad (num, padLen) {
  var padding = '0000';
  num = String(num);
  return padding.substring(0, padLen - num.length) + num;
}
456912
function length(value) {
  var prefix

  /* istanbul ignore if - Currently also tested for at implemention, but we
   * keep it here because that’s proper. */
  if (value.charAt(0) !== ampersand) {
    return 0
  }

  prefix = value.split(ampersand, 2).join(ampersand)

  return prefix.length - decode(prefix).length
}
1046904
function rpad(str, len, padstr) {
	var str = ""+str;
	if(str.length >= len) return str;
	return str + Array(len + 1 - str.length).join(padstr);
}
1226995
public static function pad($value, $length = 5, $prfx = 0)
	{
		$pre = '';

		if (is_numeric($value) && $value < 0)
		{
			$pre = 'n';
			$value = abs($value);
		}

		while (strlen($value) < $length)
		{
			$value = $prfx . "$value";
		}
		return $pre . $value;
	}
51731
function truncate (value, length) {
  length = length || 15
  if( !value || typeof value !== 'string' ) return ''
  if( value.length <= length) return value
  return value.substring(0, length) + '...'
}
173064
function padRight(val, len, offset, char) {
    /* istanbul ignore if */
    if (!is_1.isValue(val) || !is_1.isString(val))
        return null;
    // If offset is a string
    // count its length.
    if (is_1.isString(offset))
        offset = offset.length;
    char = char || ' ';
    while (len--) {
        val += char;
    }
    if (offset)
        val += padRight('', offset, null, char);
    return val;
}
441327
function pad (content, length) {
    content = content || ''

    while (content.length < length) {
      content = content + ' '
    }

    return content
  }
1037248
def _truncate(value, arg):
        
        length = int(arg)
        if value is None:
            value = ""
        if len(value) > length:
            return value[:length] + "..."
        else:
            return value
315044
function pad(number, length) {
	// Create an array of the remaining length +1 and join it with 0's
	return new Array((length || 2) + 1 - String(number).length).join(0) + number;
}
969313
function pad(text, length, align = 'left') {
  let pad = ' '.repeat(length - stringWidth(text));
  if (align === 'right') {
    return pad + text;
  }

  return text + pad;
}
746221
function pad(number, size) {
        var stringNum = String(number);

        while (stringNum.length < (size || 2)) {
            stringNum = '0' + stringNum;
        }

        return stringNum;
    }