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

API design suggestion: path arrays #11

Open
callumlocke opened this issue Jul 8, 2016 · 0 comments
Open

API design suggestion: path arrays #11

callumlocke opened this issue Jul 8, 2016 · 0 comments

Comments

@callumlocke
Copy link

Hi Rich

I really like the way sander automatically path-resolves multiple string arguments.

But this comes at a cost:

  • you have to invent a new API for all methods that involve two paths (the .to() chain)
  • you can't support shortcuts like utf8 for {encoding: 'utf8'}

IMO these are big caveats. They stop sander from feeling like a drop-in replacement for fs. And I still trip up on them a lot and find myself scanning the readme again, even though I've been using sander for a long time.

Why not just provide this functionality via arrays? ie...

sander.writeFile([someDir, 'foo.txt'], content);

That is, any path arguments would have to be provided as either a single string or an array of strings. But always a single argument. (Obviously this would entail a major version bump.)

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

1 participant