Open alexstandiford opened 3 years ago
Which implies that the data that is fed to the function needs to be a JSON string, however, it seems that this needs to be a JavaScript object.
In CJS, when you require
json, it gets passed through JSON.parse
automatically resulting in a JS object, though one might not be familiar with that who are new to CJS or node.
I would accept a PR clarifying the API.
though one might not be familiar with that who are new to CJS or node.
... one such as myself ;)
Anyway, trying to write a command-line filter jsonfeed-to-rss
, I figured out that I could write it
#!/bin/env node
const jsonfeedToRSS = require('jsonfeed-to-rss')
const someJSONFeed = require('/dev/stdin')
const rssFeed = jsonfeedToRSS(someJSONFeed) // Returns an rss 2.0.11 formatted json feed
console.log(rssFeed)
and invoke it as
./jsonfeed-to-rss < load-some-json-feed-data.json > load-some-json-feed-data.rss
which might serve as a good working example instead of (in addition to) your existing USAGE
Thats a nice trick! Maybe I should ship a simple CLI with something similar.
Hi! Thanks for writing this, it's quite nice!
Currently the docs show this:
Which implies that the data that is fed to the function needs to be a JSON string, however, it seems that this needs to be a JavaScript object.
I'm not sure if this is a bug, or if the documentation is just misleading.
By providing a JSON string, I received a misleading error mentioned in #32, which made me think that it was because I was missing an argument that I wasn't missing.
It would be helpful if:
I'd be happy to spin up a PR, but didn't want to do that until after I raised the issue. Thanks again!