Skip to content

Commit

Permalink
refactor: Replace _.size with native counterparts (#7798)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisVillanueva committed Jun 1, 2020
1 parent 4db8b63 commit 2b00928
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/classes/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Utils {
});

// function related information retrieval
const numberOfFunctions = _.size(functions);
const numberOfFunctions = functions ? Object.keys(functions).length : 0;

const memorySizeAndTimeoutPerFunction = [];
if (numberOfFunctions) {
Expand Down Expand Up @@ -292,7 +292,7 @@ class Utils {
isRunInService: !!serverless.config.servicePath,
},
service: {
numberOfCustomPlugins: _.size(service.plugins),
numberOfCustomPlugins: service.plugins ? service.plugins.length : 0,
hasCustomResourcesDefined,
hasVariablesInCustomSectionDefined: !!service.custom,
hasCustomVariableSyntaxDefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function handleTags() {
tagKeys: tagKeysToBeRemoved,
});
}
if (!_.isEqual(currentTags, tagsMerged) && _.size(tagsMerged) > 0) {
if (!_.isEqual(currentTags, tagsMerged) && Object.keys(tagsMerged).length > 0) {
this.apiGatewayTagResourceParams.push({
resourceArn,
tags: tagsMerged,
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/aws/provider/awsProvider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ describe('AwsProvider', () => {

return BbPromise.all(requests)
.then(results => {
expect(_.size(results, 2));
expect(Object.keys(results).length).to.equal(2);
results.forEach(result => {
expect(result).to.deep.equal(expectedResult);
});
Expand Down Expand Up @@ -819,7 +819,7 @@ describe('AwsProvider', () => {

return BbPromise.all(requests)
.then(results => {
expect(_.size(results, numTests));
expect(Object.keys(results).length).to.equal(numTests);
results.forEach(result => {
expect(result).to.deep.equal(expectedResult);
});
Expand Down

0 comments on commit 2b00928

Please sign in to comment.