Skip to content

Commit 6ad62e4

Browse files
committedMar 9, 2024
refactor: remove usage of _.map
1 parent feb75fa commit 6ad62e4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
 

‎src/dependency.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class Dependency {
5151
this.author = pkg.author ? new Person(pkg.author) : null;
5252

5353
// Parse the contributor array.
54-
this.contributors = _.map(_.castArray(pkg.contributors || []), (contributor) => (
54+
this.contributors = _.castArray(pkg.contributors || []).map((contributor) => (
5555
new Person(contributor)
5656
));
5757

‎src/license-plugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ class LicensePlugin {
565565
// Allow custom formatting of output using given template option.
566566
const template = _.isString(output.template) ? (dependencies) => _.template(output.template)({dependencies, _, moment}) : output.template;
567567
const defaultTemplate = (dependencies) => (
568-
dependencies.length === 0 ? 'No third parties dependencies' : _.map(dependencies, (d) => d.text()).join(`${EOL}${EOL}---${EOL}${EOL}`)
568+
dependencies.length === 0 ? 'No third parties dependencies' : dependencies.map((d) => d.text()).join(`${EOL}${EOL}---${EOL}${EOL}`)
569569
);
570570

571571
const text = _.isFunction(template) ? template(outputDependencies) : defaultTemplate(outputDependencies);

‎src/schema-validator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function doItemValidation(value, schema, path) {
4343
return [
4444
{
4545
path,
46-
message: _.map(validators, (validator) => `"${formatPath(path)}" ${validator.message}`).join(' OR '),
46+
message: validators.map((validator) => `"${formatPath(path)}" ${validator.message}`).join(' OR '),
4747
},
4848
];
4949
}

‎test/base.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ beforeEach(() => {
4444
o1.author = _.toPlainObject(o1.author);
4545
}
4646
if (o1.contributors) {
47-
o1.contributors = _.map(o1.contributors, _.toPlainObject);
47+
o1.contributors = o1.contributors.map((o) => _.toPlainObject(o));
4848
}
4949

5050
if (o2.author) {
5151
o2.author = _.toPlainObject(o2.author);
5252
}
5353
if (o2.contributors) {
54-
o2.contributors = _.map(o2.contributors, _.toPlainObject);
54+
o2.contributors = o2.contributors.map((o) => _.toPlainObject(o));
5555
}
5656

5757
return _.isEqual(o1, o2);

0 commit comments

Comments
 (0)
Please sign in to comment.