Skip to content

Commit

Permalink
Update packages/puppeteer-core/src/node/ChromeLauncher.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
  • Loading branch information
thiagowfx and Lightning00Blade committed Oct 13, 2023
1 parent 2ce2f59 commit 99f6c62
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/puppeteer-core/src/node/ChromeLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ function convertPuppeteerChannelToBrowsersChannel(
* @internal
*/
export function getFeatures(flag: string, options: string[] = []): string[] {
const opts = options
return options
.filter(s => {
return s.startsWith(flag.endsWith('=') ? flag : `${flag}=`);
})
.map(s => {
return s.split(new RegExp(`${flag}` + '=\\s*'))[1]?.trim();
});
return opts.length === 0 ? [] : opts.join(',').split(',');
return s.split(new RegExp(`${flag}=\\s*`))[1]?.trim();
})
.filter(s => {
return s;
}) as string[];
}

0 comments on commit 99f6c62

Please sign in to comment.