Blame view

node_modules/stylus/lib/functions/math.js 347 Bytes
ce4c83ff   wxy   初始提交
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);
  };