(args)
| 15 | } |
| 16 | |
| 17 | call(args) { |
| 18 | if (!(Array.isArray(args))) { |
| 19 | args = [args]; |
| 20 | } |
| 21 | const evalArgs = this.func.evalArgs; |
| 22 | if (evalArgs !== false) { |
| 23 | args = args.map(a => a.eval(this.context)); |
| 24 | } |
| 25 | const commentFilter = item => !(item.type === 'Comment'); |
| 26 | |
| 27 | // This code is terrible and should be replaced as per this issue... |
| 28 | // https://github.com/less/less.js/issues/2477 |
| 29 | args = args |
| 30 | .filter(commentFilter) |
| 31 | .map(item => { |
| 32 | if (item.type === 'Expression') { |
| 33 | const subNodes = item.value.filter(commentFilter); |
| 34 | if (subNodes.length === 1) { |
| 35 | // https://github.com/less/less.js/issues/3616 |
| 36 | if (item.parens && subNodes[0].op === '/') { |
| 37 | return item; |
| 38 | } |
| 39 | return subNodes[0]; |
| 40 | } else { |
| 41 | return new Expression(subNodes); |
| 42 | } |
| 43 | } |
| 44 | return item; |
| 45 | }); |
| 46 | |
| 47 | if (evalArgs === false) { |
| 48 | return this.func(this.context, ...args); |
| 49 | } |
| 50 | |
| 51 | return this.func(...args); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export default functionCaller; |
no test coverage detected