From 06ece25406d9e5f27c27fb72415594405701f91a Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 23 Oct 2019 11:44:57 +0200 Subject: [PATCH] chore: use map instead of plain object --- lib/LifecycleWatcher.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/LifecycleWatcher.js b/lib/LifecycleWatcher.js index 747675bcbf3c7..ab997e5996a82 100644 --- a/lib/LifecycleWatcher.js +++ b/lib/LifecycleWatcher.js @@ -31,7 +31,7 @@ class LifecycleWatcher { else if (typeof waitUntil === 'string') waitUntil = [waitUntil]; this._expectedLifecycle = waitUntil.map(value => { - const protocolEvent = puppeteerToProtocolLifecycle[value]; + const protocolEvent = puppeteerToProtocolLifecycle.get(value); assert(protocolEvent, 'Unknown value for options.waitUntil: ' + value); return protocolEvent; }); @@ -188,11 +188,11 @@ class LifecycleWatcher { } } -const puppeteerToProtocolLifecycle = { - 'load': 'load', - 'domcontentloaded': 'DOMContentLoaded', - 'networkidle0': 'networkIdle', - 'networkidle2': 'networkAlmostIdle', -}; +const puppeteerToProtocolLifecycle = new Map([ + ['load', 'load'], + ['domcontentloaded', 'DOMContentLoaded'], + ['networkidle0', 'networkIdle'], + ['networkidle2', 'networkAlmostIdle'], +]); module.exports = {LifecycleWatcher};