Skip to content

Commit

Permalink
Remove is-plain-object (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Apr 9, 2024
1 parent 197510d commit c531af9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -41,7 +41,6 @@
"escape-string-regexp": "^4.0.0",
"gzip-size": "^6.0.0",
"html-escaper": "^2.0.2",
"is-plain-object": "^5.0.0",
"opener": "^1.5.2",
"picocolors": "^1.0.0",
"sirv": "^2.0.3",
Expand Down
12 changes: 8 additions & 4 deletions src/viewer.js
Expand Up @@ -4,7 +4,6 @@ const http = require('http');

const WebSocket = require('ws');
const sirv = require('sirv');
const {isPlainObject} = require('is-plain-object');
const {bold} = require('picocolors');

const Logger = require('./Logger');
Expand Down Expand Up @@ -190,7 +189,12 @@ function getChartData(analyzerOpts, ...args) {
chartData = null;
}

if (isPlainObject(chartData) && Object.keys(chartData).length === 0) {
// chartData can either be an array (bundleInfo[]) or null. It can't be an plain object anyway
if (
// analyzer.getViewerData() doesn't failed in the previous step
chartData
&& !Array.isArray(chartData)
) {
logger.error("Could't find any javascript bundles in provided stats file");
chartData = null;
}
Expand All @@ -199,8 +203,8 @@ function getChartData(analyzerOpts, ...args) {
}

function getEntrypoints(bundleStats) {
if (bundleStats === null || bundleStats === undefined) {
if (bundleStats === null || bundleStats === undefined || !bundleStats.entrypoints) {
return [];
}
return Object.values(bundleStats.entrypoints || {}).map(entrypoint => entrypoint.name);
return Object.values(bundleStats.entrypoints).map(entrypoint => entrypoint.name);
}

0 comments on commit c531af9

Please sign in to comment.