node-wolfram icon indicating copy to clipboard operation
node-wolfram copied to clipboard

Added ability to pass options to a query

Open MarkAYoder opened this issue 9 years ago • 2 comments

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

MarkAYoder avatar Dec 02 '14 01:12 MarkAYoder

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:

strax avatar Jun 28 '15 21:06 strax

Note that #12 implements the aforementioned functionality without unit tests though

strax avatar Jun 28 '15 21:06 strax