Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: read is not a function #1

Open
mk-pmb opened this issue Oct 7, 2018 · 3 comments
Open

TypeError: read is not a function #1

mk-pmb opened this issue Oct 7, 2018 · 3 comments

Comments

@mk-pmb
Copy link

mk-pmb commented Oct 7, 2018

Thanks for this great module!
However, the API example code from the readme doesn't work, because the module exports an object with one method, instead of a function:

$ nodever fs-read-data
require('fs-read-data/package.json').version = 1.0.4
Node.js v8.12.0, npm v6.4.1, Ubuntu 14.04.5 LTS trusty,
kernel: 3.13.0-154-generic, machine/CPU/platform: i686 i686 i686

$ nodejs
> const read = require('fs-read-data');
undefined
> const data = read('package.json');
TypeError: read is not a function
> read
{ readFile: [Function] }

I'd prefer the function be exported directly. For compatibility, the function should get a readFile property with a self-reference until the next major version bump.

@dkebler
Copy link

dkebler commented Sep 24, 2019

@mk-pmb Agree! This is the best/simpliest package for just reading in any config file (incluing js!)

One year later still the readme is still incorrect.

For single export modules I export as default as well as named. Then one is covered.

Couple easy fixes...if @sramam doesn't do might do a PR

@mk-pmb
Copy link
Author

mk-pmb commented Sep 24, 2019

A while ago I made an alias package read-data-file, primarily in hopes npm would show me what I'm looking for each time I search for "read data file". Nowadays it finally does, somewhat. Still buried below a lot of other packages, but at least on page 1 of results. That's probably as good as npm search can get.

@sramam
Copy link
Member

sramam commented Sep 24, 2019

Apologies - I had stopped using this package and didn't realize it was so bothersome.
I would be happy to accept a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants