(args, math, scope)
| 17 | const forEach = createForEach({ typed }) |
| 18 | const transformCallback = createTransformCallback({ typed }) |
| 19 | function forEachTransform (args, math, scope) { |
| 20 | if (args.length === 0) { |
| 21 | return forEach() |
| 22 | } |
| 23 | let x = args[0] |
| 24 | |
| 25 | if (args.length === 1) { |
| 26 | return forEach(x) |
| 27 | } |
| 28 | |
| 29 | const N = args.length - 1 |
| 30 | let callback = args[N] |
| 31 | |
| 32 | if (x) { |
| 33 | x = _compileAndEvaluate(x, scope) |
| 34 | } |
| 35 | |
| 36 | if (callback) { |
| 37 | if (isSymbolNode(callback) || isFunctionAssignmentNode(callback)) { |
| 38 | // a function pointer, like filter([3, -2, 5], myTestFunction) |
| 39 | callback = _compileAndEvaluate(callback, scope) |
| 40 | } else { |
| 41 | // an expression like filter([3, -2, 5], x > 0) |
| 42 | callback = compileInlineExpression(callback, math, scope) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | return forEach(x, transformCallback(callback, N)) |
| 47 | } |
| 48 | forEachTransform.rawArgs = true |
| 49 | |
| 50 | function _compileAndEvaluate (arg, scope) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…