[Pkg-javascript-commits] [less.js] 06/88: Improved min/max function, 2 new Built in function
Jonas Smedegaard
dr at jones.dk
Mon Oct 26 23:22:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag v1.7.0
in repository less.js.
commit bf2a49a12e79ac168b59c23174e96c3e8e511722
Author: deviprsd21 <deviprsd21 at gmail.com>
Date: Sat Jan 11 17:43:24 2014 +0530
Improved min/max function, 2 new Built in function
max(0, 1em, 2, 4px) //returns 4px on the basis of first enter basis. Previous calculation would result in max(2, 1em, 4px). Here, 2 and 1em is compared, 2 is returned. then 2 and 4px is compared. Resulting in 4px. max(0, 1em, 1, 4px) //max(1em, 4px)
---
lib/less/functions.js | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
diff --git a/lib/less/functions.js b/lib/less/functions.js
index cbddee5..85145b7 100644
--- a/lib/less/functions.js
+++ b/lib/less/functions.js
@@ -276,29 +276,12 @@ tree.functions = {
continue;
}
currentUnified = current.unify();
- unit = currentUnified.unit.toString();
- if(unit === "" && unitStatic !== undefined) {
- unit = unitStatic;
- } else if(unit === "") {
- unit = "variable";
- }
- unitStatic = unit !== "variable" && unitStatic === undefined ? unit : unitStatic;
- values[unit] = values["variable"] !== undefined && unit !== "variable" && unit === unitStatic ? values["variable"] : values[unit];
+ unit = currentUnified.unit.toString() === "" && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString();
+ unitStatic = unit !== "" && unitStatic === undefined || unit !== "" && order[0].unify().unit.toString() === "" ? unit : unitStatic;
+ values[unit] = values[""] !== undefined && unit !== "" && unit === unitStatic ? values[""] : values[unit];
j = values[unit];
if (j === undefined) {
values[unit] = order.length;
- //error handling for incompatible types
- if((values["px"] !== undefined && values["em"] !== undefined) || (values["px"] !== undefined && values["%"] !== undefined) ||
- (values["px"] !== undefined && values["m"] !== undefined) || (values["px"] !== undefined && values["s"] !== undefined) ||
- (values["px"] !== undefined && values["rad"] !== undefined) || (values["em"] !== undefined && values["%"] !== undefined) ||
- (values["em"] !== undefined && values["m"] !== undefined) || (values["em"] !== undefined && values["s"] !== undefined) ||
- (values["em"] !== undefined && values["rad"] !== undefined) || (values["%"] !== undefined && values["m"] !== undefined) ||
- (values["%"] !== undefined && values["s"] !== undefined) || (values["%"] !== undefined && values["rad"] !== undefined) ||
- (values["m"] !== undefined && values["s"] !== undefined) || (values["m"] !== undefined && values["rad"] !== undefined) ||
- (values["s"] !== undefined && values["rad"] !== undefined))
- {
- throw { type: "Argument", message: "incompatible types" };
- }
order.push(current);
continue;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git
More information about the Pkg-javascript-commits
mailing list