I have the following function I want to make sure that I can execute foo
function multiple times before executing final execute
function:
let test = (object) => {
return {
foo: (condition) => {
return {
execute: () => {
return object.filter(obj => condition(obj))
},
foo: // Call same function
}
},
}
}
console.log(
test(object).foo(condition1).foo(condition2).execute();
);