Skip to content

Instantly share code, notes, and snippets.

@jney
Created April 25, 2011 12:08
Show Gist options
  • Select an option

  • Save jney/940420 to your computer and use it in GitHub Desktop.

Select an option

Save jney/940420 to your computer and use it in GitHub Desktop.
get every Math constants and functions in less.js
if( '__proto__' in {} ) {
tree.functions = Math.__proto__;
} else {
var mathFn = 'E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2 abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan'.split(' ');
for (var i = 0; i < mathFn.length; i++) {
tree.functions[mathFn[i]] = Math[mathFn[i]];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment