Skip to content

Commit

Permalink
Merge pull request #1769 from lesswtf/master
Browse files Browse the repository at this point in the history
If result of evaluated javascript is a number return it as Dimension.
  • Loading branch information
lukeapage committed Dec 31, 2013
2 parents 3a0f97e + 216facd commit c1b70ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/less/tree/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ tree.JavaScript.prototype = {
throw { message: "JavaScript evaluation error: '" + e.name + ': ' + e.message + "'" ,
index: this.index };
}
if (typeof(result) === 'string') {
if (typeof(result) === 'number') {
return new(tree.Dimension)(result);
} else if (typeof(result) === 'string') {
return new(tree.Quoted)('"' + result + '"', result, this.escaped, this.index);
} else if (Array.isArray(result)) {
return new(tree.Anonymous)(result.join(', '));
Expand Down

0 comments on commit c1b70ba

Please sign in to comment.