1 | var utils = require('../utils');
|
2 |
|
3 | /**
|
4 | * Perform `op` on the `left` and `right` operands.
|
5 | *
|
6 | * @param {String} op
|
7 | * @param {Node} left
|
8 | * @param {Node} right
|
9 | * @return {Node}
|
10 | * @api public
|
11 | */
|
12 |
|
13 | function operate(op, left, right){
|
14 | utils.assertType(op, 'string', 'op');
|
15 | utils.assertPresent(left, 'left');
|
16 | utils.assertPresent(right, 'right');
|
17 | return left.operate(op.val, right);
|
18 | }
|
19 | operate.params = ['op', 'left', 'right'];
|
20 | module.exports = operate;
|