Skip to content

Commit 84ce097

Browse files
committed
Remove lodash dependency
* Use native ES2015 String.prototype.repeat, which is implemented since Node.js 7, whereas this package requires Node.js 10+. * Use plain JavaScript for two default properties. Ref gruntjs/grunt-legacy-log#35
1 parent 7fed7b5 commit 84ce097

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
'use strict';
1111

1212
var chalk = require('chalk');
13-
var _ = require('lodash');
1413

1514
// Pretty-format a word list.
1615
exports.wordlist = function(arr, options) {
17-
options = _.defaults(options || {}, {
18-
separator: ', ',
19-
color: 'cyan'
20-
});
16+
options = options || {};
17+
if (options.separator === undefined) {
18+
options.separator = ', ';
19+
}
20+
if (options.color === undefined) {
21+
options.color = 'cyan';
22+
}
2123
return arr.map(function(item) {
2224
return options.color ? chalk[options.color](item) : item;
2325
}).join(options.separator);
@@ -106,7 +108,7 @@ exports.table = function(widths, texts) {
106108
column = row[i] || '';
107109
txt += column;
108110
var diff = widths[i] - this.uncolor(column).length;
109-
if (diff > 0) { txt += _.repeat(' ', diff); }
111+
if (diff > 0) { txt += ' '.repeat(diff); }
110112
}
111113
lines.push(txt);
112114
}, this);

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@
2727
"legacy"
2828
],
2929
"dependencies": {
30-
"chalk": "~4.1.0",
31-
"lodash": "~4.17.19"
30+
"chalk": "^4.1.0"
3231
},
3332
"devDependencies": {
34-
"grunt": "~1.2.1",
35-
"grunt-contrib-jshint": "~2.1.0",
36-
"grunt-contrib-nodeunit": "~2.1.0",
37-
"grunt-contrib-watch": "~1.1.0"
33+
"grunt": "^1.2.1",
34+
"grunt-contrib-jshint": "^2.1.0",
35+
"grunt-contrib-nodeunit": "^2.1.0",
36+
"grunt-contrib-watch": "^1.1.0"
3837
}
3938
}

0 commit comments

Comments
 (0)