aboutsummaryrefslogtreecommitdiff
path: root/node_modules/stylus/lib/functions/math.js
blob: c3ef6818278ebda88caff1a8c516c2bcabd548f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var utils = require('../utils')
  , nodes = require('../nodes');

/**
 * Apply Math `fn` to `n`.
 *
 * @param {Unit} n
 * @param {String} fn
 * @return {Unit}
 * @api private
 */

module.exports = function math(n, fn){
  utils.assertType(n, 'unit', 'n');
  utils.assertString(fn, 'fn');
  return new nodes.Unit(Math[fn.string](n.val), n.type);
};