Object argument when many arguments
curran opened this issue · comments
Sometimes it's cumbersome to have lots of dependencies.
The following form should work:
my("fullName", function (props){
return props.firstName + " " + props.lastName;
}, "firstName, lastName");
We just need to check how many arguments the reactive function callback accepts.
Checking the number of arguments is actually rather sketchy, as it doesn't work sometimes under ES6 transpilation. Better to be explicit. Maybe something like this:
my("fullName", function (props){
return props.firstName + " " + props.lastName;
}, "firstName, lastName");
my._("fullName", function (props){
return props.firstName + " " + props.lastName;
}, "firstName, lastName");
or
my.asObject("fullName", function (props){
return props.firstName + " " + props.lastName;
}, "firstName, lastName");
or
my("fullName", function (props){
return props.firstName + " " + props.lastName;
}, "{firstName, lastName}");
or
my("fullName", function (props){
return props.firstName + " " + props.lastName;
}, {props: "firstName, lastName"});
or
my("fullName", function (props){
return props.firstName + " " + props.lastName;
}, {props: ["firstName", "lastName"]});