writes the transforms of data's elements, into `copy` before the first change or, without one, in place
(js: NodeCompiler, copy: string | undefined)
| 444 | |
| 445 | /** writes the transforms of data's elements, into `copy` before the first change or, without one, in place */ |
| 446 | jsElemTfs(js: NodeCompiler, copy: string | undefined): NodeCompiler { |
| 447 | let i = 0 |
| 448 | this.jsElements(js, (keyExpr, node) => { |
| 449 | const element = `element${i}` |
| 450 | const transformed = `elementTf${i++}` |
| 451 | return js |
| 452 | .const(element, `data[${keyExpr}]`) |
| 453 | .tfKey(transformed, element, [{ node }], { |
| 454 | keyExpr, |
| 455 | onChange: () => |
| 456 | (copy ? js.if("out === data", () => js.set("out", copy)) : js).line( |
| 457 | `out[${keyExpr}] = ${transformed}` |
| 458 | ) |
| 459 | }) |
| 460 | }) |
| 461 | return js |
| 462 | } |
| 463 | |
| 464 | /** writes the checks of data's elements */ |
| 465 | private jsElements( |