You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var clues = require("clues");
var logic = {
user: {
name: "Meow Zedong",
},
answer: 42,
message: ['user.name', function(name, answer) {
return name + ", the answer is: " + answer;
}]
};
clues(logic, 'message').then(function(res){
console.log(res);
});
This results in:
Meow Zedong, the answer is: undefined
Obviously this will work as we expect if the array-style arguments also include answer ... but do you think that the positional arguments in the array could be extended by the arguments in the function?
I found that when using reptiles with some user input I end up seeing something like
var api = {
something: ['input.A', 'B', 'C', 'D', 'E', function(a, b, c, d, e){
...
}
}
... and it feels very verbose when it's just the first variable that needs the object resolution. Would be much nicer if it were:
var api = {
something: ['input.A', function(a, b, c, d, e){
...
}
}
The text was updated successfully, but these errors were encountered:
// Support an array with argument names in front and the function as last element
if (typeof fn === 'object' && fn.length && typeof fn[fn.length-1] == 'function') {
args = fn.slice(0,fn.length-1);
fn = fn[fn.length-1];
matchArgs(fn).forEach(function(d,i) {
if (args[i] === undefined) args[i] = d;
});
}
Consider the following:
This results in:
Obviously this will work as we expect if the array-style arguments also include
answer
... but do you think that the positional arguments in the array could be extended by the arguments in the function?I found that when using reptiles with some user input I end up seeing something like
... and it feels very verbose when it's just the first variable that needs the object resolution. Would be much nicer if it were:
The text was updated successfully, but these errors were encountered: