blob: 8973d029e77fbd775214fd69cce14f26d7a10b01 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2var indentString = require('indent-string');
3var longest = require('longest');
4
5module.exports = function (str, arr, indent) {
6 var pad = typeof indent === 'number' ? indent : 0;
7
8 if (typeof str !== 'string') {
9 throw new TypeError('Expected a `string`, got `' + typeof str + '`');
10 }
11
12 if (!Array.isArray(arr)) {
13 throw new TypeError('Expected an `Array`, got `' + typeof arr + '`');
14 }
15
16 return indentString(str, ' ', pad + longest(arr).length - str.length);
17};