JSTQL-JS-Transform/output_testing/1057conditional-early-return.js

61 lines
980 B
JavaScript
Raw Normal View History

/**
* props.b does *not* influence `a`
*/
function ComponentA(props) {
const a_DEBUG = [];
props.a |> a_DEBUG.push(%);
if (props.b) {
return null;
}
props.d |> a_DEBUG.push(%);
return a_DEBUG;
}
/**
* props.b *does* influence `a`
*/
function ComponentB(props) {
const a = [];
props.a |> a.push(%);
if (props.b) {
props.c |> a.push(%);
}
props.d |> a.push(%);
return a;
}
/**
* props.b *does* influence `a`, but only in a way that is never observable
*/
function ComponentC(props) {
const a = [];
props.a |> a.push(%);
if (props.b) {
props.c |> a.push(%);
return null;
}
props.d |> a.push(%);
return a;
}
/**
* props.b *does* influence `a`
*/
function ComponentD(props) {
const a = [];
props.a |> a.push(%);
if (props.b) {
props.c |> a.push(%);
return a;
}
props.d |> a.push(%);
return a;
}
export const FIXTURE_ENTRYPOINT = {
fn: ComponentA,
params: [{
a: 1,
b: false,
d: 3
}]
};