node-wolfram
node-wolfram copied to clipboard
Added ability to pass options to a query
I made a simple change so options can be sent.
wolfram.query({search: "words containing msdoep", options: "&podstate=WordsMadeWithOnlyLetters__Show+all" + "&podstate=WordsMadeWithOnlyLetters__Disallow+repetition" + "&includepodid=WordsMadeWithOnlyLetters"}, function(err, result) { if(err) throw err console.log("Size: %d", result.length); console.log("Result: %j", result[0].subpods[0].value); })
If a string is passed as the first parameter, then query works as before.
--Mark
Sorry for the long delay answering!
I'd rather see this evolve to a more native way of passing in options. Your example could be written as:
wolfram.query({
search: "words containing msdoep",
options: {
podstate: ["WordsMadeWithOnlyLetters__Show+all", "WordsMadeWithOnlyLetters__Disallow+repetition"],
includepodid: "WordsMadeWithOnlyLetters"
}
});
If you can modify the code to parse an options hash into a query string, I'd be happy to merge :blush:
Note that #12 implements the aforementioned functionality without unit tests though