UNPKG

548 BJavaScriptView Raw
1'use strict';
2
3/* eslint-disable prefer-rest-params */
4
5const die = process.exit.bind(process);
6
7function extend(target) {
8 Array.prototype.slice.call(arguments, 1).forEach(source => {
9 Object.keys(source).forEach(key => {
10 /* istanbul ignore else */
11 if (typeof target[key] === 'undefined') {
12 target[key] = source[key];
13 }
14 });
15 });
16
17 return target;
18}
19
20function padding(value, max) {
21 return `${value}${new Array(value.length + max).join(' ')}`.substr(0, max);
22}
23
24module.exports = {
25 die,
26 extend,
27 padding,
28};