Skip to content

Commit 9e29543

Browse files
used hasownproperty instead of in
1 parent 947ed56 commit 9e29543

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/lib/processSnapshot.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
229229
processedOptions.web = {};
230230

231231
// Check and process viewports in web
232-
if (options.web.viewports && Array.isArray(options.web.viewports) && options.web.viewports.length > 0) {
232+
if (options.web.viewports && options.web.viewports.length > 0) {
233233
processedOptions.web.viewports = options.web.viewports.filter(viewport =>
234234
Array.isArray(viewport) && viewport.length > 0
235235
);
236236
}
237237

238238
// Check and process browsers in web
239-
if (options.web.browsers && Array.isArray(options.web.browsers) && options.web.browsers.length > 0) {
239+
if (options.web.browsers && options.web.browsers.length > 0) {
240240
processedOptions.web.browsers = options.web.browsers;
241241
}
242242
}
@@ -245,19 +245,19 @@ async function processSnapshot(snapshot: Snapshot, ctx: Context): Promise<Record
245245
processedOptions.mobile = {};
246246

247247
// Check and process devices in mobile
248-
if (options.mobile.devices && Array.isArray(options.mobile.devices) && options.mobile.devices.length > 0) {
248+
if (options.mobile.devices && options.mobile.devices.length > 0) {
249249
processedOptions.mobile.devices = options.mobile.devices;
250250
}
251251

252252
// Check if 'fullPage' is provided and is a boolean, otherwise set default to true
253-
if ('fullPage' in options.mobile && typeof options.mobile.fullPage === 'boolean') {
253+
if (options.mobile.hasOwnProperty('fullPage') && typeof options.mobile.fullPage === 'boolean') {
254254
processedOptions.mobile.fullPage = options.mobile.fullPage;
255255
} else {
256256
processedOptions.mobile.fullPage = true; // Default value for fullPage
257257
}
258258

259259
// Check if 'orientation' is provided and is valid, otherwise set default to 'portrait'
260-
if ('orientation' in options.mobile && (options.mobile.orientation === 'portrait' || options.mobile.orientation === 'landscape')) {
260+
if (options.mobile.hasOwnProperty('orientation') && (options.mobile.orientation === 'portrait' || options.mobile.orientation === 'landscape')) {
261261
processedOptions.mobile.orientation = options.mobile.orientation;
262262
} else {
263263
processedOptions.mobile.orientation = 'portrait'; // Default value for orientation

0 commit comments

Comments
 (0)