Skip to content

Commit

Permalink
refactor: remove usage of _.isEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeanroy committed Mar 9, 2024
1 parent 1e7e8e5 commit fbac97d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Dependency {
lines.push(`Author: ${this.author.text()}`);
}

if (!_.isEmpty(this.contributors)) {
if (this.contributors.length > 0) {
lines.push(`Contributors:`);

const allContributors = _.chain(this.contributors)
Expand Down
4 changes: 2 additions & 2 deletions src/license-plugin-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function doValidation(options) {
*/
function validateOptions(options) {
const errors = doValidation(options);
if (_.isEmpty(errors)) {
if (errors.length === 0) {
return;
}

Expand All @@ -148,7 +148,7 @@ function validateOptions(options) {
}
});

if (!_.isEmpty(messages)) {
if (messages.length > 0) {
throw new Error(
`[${PLUGIN_NAME}] -- Error during validation of option object: ${messages.join(' ; ')}`,
);
Expand Down
2 changes: 1 addition & 1 deletion src/license-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class LicensePlugin {
// Allow custom formatting of output using given template option.
const template = _.isString(output.template) ? (dependencies) => _.template(output.template)({dependencies, _, moment}) : output.template;
const defaultTemplate = (dependencies) => (
_.isEmpty(dependencies) ? 'No third parties dependencies' : _.map(dependencies, (d) => d.text()).join(`${EOL}${EOL}---${EOL}${EOL}`)
dependencies.length === 0 ? 'No third parties dependencies' : _.map(dependencies, (d) => d.text()).join(`${EOL}${EOL}---${EOL}${EOL}`)
);

const text = _.isFunction(template) ? template(outputDependencies) : defaultTemplate(outputDependencies);
Expand Down
2 changes: 1 addition & 1 deletion src/schema-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function doItemValidation(value, schema, path) {
const matchedValidators = _.filter(validators, (validator) => validator.test(value));

// No one matched, we can stop here and return an error with a proper message.
if (_.isEmpty(matchedValidators)) {
if (matchedValidators.length === 0) {
return [
{
path,
Expand Down

0 comments on commit fbac97d

Please sign in to comment.