Skip to content

Commit

Permalink
Remove named capture group (#80)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <[email protected]>
  • Loading branch information
danilobuerger and sindresorhus committed Sep 10, 2022
1 parent 79a21b8 commit 219ffe6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ function assembleStyles() {
},
hexToRgb: {
value: hex => {
const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}

let {colorString} = matches.groups;
let [colorString] = matches;

if (colorString.length === 3) {
colorString = [...colorString].map(character => character + character).join('');
Expand Down

0 comments on commit 219ffe6

Please sign in to comment.