Skip to content

Commit

Permalink
Altering to repo's prettier warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
themojache committed Apr 14, 2024
1 parent ae3c222 commit a910d7d
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions lib/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ var percentRegEx = /^[-+]?[0-9]*\.?[0-9]+%$/;
var urlRegEx = /^url\(\s*([^)]*)\s*\)$/;
var stringRegEx = /^("[^"]*"|'[^']*')$/;
var colorRegEx1 = /^#([0-9a-fA-F]{3,4}){1,2}$/;
var colorRegEx2 = /^rgba?\(\s*((?:(?:none|[-+]?[0-9]*\.?[0-9]+%?)[\s,/]*){2,3}(?:none|[-+]?[0-9]*\.?[0-9]+%?))\s*\)$/;
var colorRegEx2 =
/^rgba?\(\s*((?:(?:none|[-+]?[0-9]*\.?[0-9]+%?)[\s,/]*){2,3}(?:none|[-+]?[0-9]*\.?[0-9]+%?))\s*\)$/;

Check warning on line 33 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 33 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 33 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
var rgbdelimiters = /[\s,/]+/;
var calcRegEx = /^calc\(([^)]*)\)$/;
var colorRegEx4 =
Expand Down Expand Up @@ -297,14 +298,20 @@ exports.parseColor = function parseColor(val) {
res = colorRegEx2.exec(val);
if (res) {
parts = res[1].split(rgbdelimiters);
[red, green, blue] = parts.slice(0, 3).map(code =>
code.toLowerCase() == "none" ? 0 :
Math.min(255, Math.max(0,
percentRegEx.test(code)
? Math.round((parseFloat(code.slice(0, -1)) * 255) / 100)
: integerRegEx.test(code)
? parseInt(code, 10)
: undefined
[red, green, blue] = parts
.slice(0, 3)

Check warning on line 302 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 302 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 302 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
.map((code) =>

Check warning on line 303 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 303 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 303 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
code.toLowerCase() == 'none'

Check warning on line 304 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Replace `······` with `········`

Check warning on line 304 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Replace `······` with `········`

Check warning on line 304 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Replace `······` with `········`
? 0

Check warning on line 305 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 305 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 305 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
: Math.min(

Check warning on line 306 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Replace `········` with `··········`

Check warning on line 306 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Replace `········` with `··········`

Check warning on line 306 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Replace `········` with `··········`
255,

Check warning on line 307 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 307 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 307 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
Math.max(

Check warning on line 308 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 308 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 308 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
0,

Check warning on line 309 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 309 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 309 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
percentRegEx.test(code)

Check warning on line 310 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (18)

Insert `··`

Check warning on line 310 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (20)

Insert `··`

Check warning on line 310 in lib/parsers.js

View workflow job for this annotation

GitHub Actions / Lint and tests (latest)

Insert `··`
? Math.round((parseFloat(code.slice(0, -1)) * 255) / 100)
: integerRegEx.test(code)
? parseInt(code, 10)
: undefined
)
)
);
Expand Down

0 comments on commit a910d7d

Please sign in to comment.