Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
Yes you are correct. The expensiveGet method needs to take 2 arguments for it to work the way it is being called in ifElse.
I have created a working example that you can run.
constS=require('sanctuary')constexpensiveGet=(y)=>{console.log("doing expensive get for",y)return2}constcondition=x=>x===100constexpensiveGetPlus=x=>y=>expensiveGet(y)+xS.ifElse(condition)(expensiveGetPlus(1))(expensiveGetPlus(-1))(100)//=> "doing expensive get for 100"
This example will show that ifElse only executes one of the functions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yes you are correct. The expensiveGet method needs to take 2 arguments for it to work the way it is being called in
ifElse
.I have created a working example that you can run.
This example will show that
ifElse
only executes one of the functions.