Skip to content

Commit

Permalink
Merge pull request #210 from prjctimg/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
prjctimg authored Jul 23, 2024
2 parents a6a0d86 + 94be262 commit db83645
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 162 deletions.
38 changes: 20 additions & 18 deletions src/internal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,30 +481,32 @@ function filteredColl(f, cb) {
//The patterns to match

const v = reNum(s),
w = reOp(s),
u = {
"!=": neq,
"==": eq,
">=": gte,
"<=": lte,
">": gt,
"<": lt,
"===": eq,
"!==": neq,
"!": not,
"/": give,
"*": mapAlphaMultiply,
"+": mapAlphaDivide,
"-": take,
};
w = reOp(s);

return and(
w,
colorObjColl(
f,
cb
)(c)
// @ts-ignore
.filter((l) => u[w](l[f], parseFloat(v.toString())))
.filter((l) => {
return {
"!=": neq,
"==": eq,
">=": gte,
"<=": lte,
">": gt,
"<": lt,
"===": eq,
"!==": neq,
"!": not,
"/": give,
"*": mult,
"+": add,
"-": take,
}[w](l[f], parseFloat(v.toString()));
})
.map((l) => l["color"])
);

Expand Down Expand Up @@ -539,7 +541,7 @@ function getSrcMode(c, m) {
? m
: or(
and(and(isArray(c), neq(typeof c[0], "number")), c[0]),
or(c?.mode, "lch")
or(c?.mode, "rgb")
).toLowerCase();
}

Expand Down
Loading

0 comments on commit db83645

Please sign in to comment.