Skip to content

Commit

Permalink
fix: factor rgbExtractRegexp out of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jan 3, 2021
1 parent fdd23fa commit 4585437
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/dom-styles-reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default class DOMStylesReader {
// ## ## ######## ######## ## ######## ## ## ######

const dotRegexp = /\.+/g
const rgbExtractRegexp = /rgb(a?)\((\d+), (\d+), (\d+)(, (\d+(\.\d+)?))?\)/

/**
* Computes the output color of `value` with a rotated hue defined
Expand All @@ -144,7 +145,7 @@ const dotRegexp = /\.+/g
* @access private
*/
function rotateHue (value, filter) {
const match = value.match(/rgb(a?)\((\d+), (\d+), (\d+)(, (\d+(\.\d+)?))?\)/)
const match = value.match(rgbExtractRegexp)
let [, , r, g, b, , a] = match

let [, hue] = filter.match(/hue-rotate\((\d+)deg\)/)
Expand Down

0 comments on commit 4585437

Please sign in to comment.