MCPcopy
hub / github.com/less/less.js / call

Method call

packages/less/lib/less/functions/function-caller.js:17–52  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

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
55export default functionCaller;

Callers 15

cloneFunction · 0.80
bootstrap.jsFile · 0.80
addDataAttrFunction · 0.80
toCSSMethod · 0.80
LessErrorFunction · 0.80
copyFromOriginalFunction · 0.80
parseFunction · 0.80
cloneFunction · 0.80
mergeFunction · 0.80
renderFunction · 0.80
expectFunction · 0.80
ParserFunction · 0.80

Calls 2

mapMethod · 0.80
evalMethod · 0.45

Tested by

no test coverage detected