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

expose .hasMagic() #36

Merged
merged 1 commit into from
Nov 4, 2016
Merged

expose .hasMagic() #36

merged 1 commit into from
Nov 4, 2016

Conversation

moeriki
Copy link

@moeriki moeriki commented Oct 26, 2016

Fixes #35.

@@ -44,6 +44,12 @@ Returns an array of objects in the format `{ pattern: string, opts: Object }`, w

Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.

### globby.hasMagic(pattern, [options]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I'm unwilling to keep documentation in sync with node-globs. Furthermore, it smells like plagiarism. As we don't modify behavior, I would suggest:

globby.hasMagic

See node-glob hasMagic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that would be much better.

Wasn't even sure if documenting it, was needed at all. Since the goal Extends glob with support for multiple patterns and exposes a Promise API already implied it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note my #35 (comment), maybe we should modify the signature–sorry for the clutter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the ; and change pattern to patterns.

@moeriki
Copy link
Author

moeriki commented Oct 26, 2016

Pull request updated.

  • hasMagic documentation references node-glob
  • hasMagic can take an array of paths and returns true if any hasMagic

@schnittstabil
Copy link
Contributor

@sindresorhus lgtm, I've manually verified v0.10 and v0.12. I'm willing to es2015ify before the next release, to drop support for v0.10 and v0.12.

@kevva, @UltCombo What do you think?

@UltCombo
Copy link
Contributor

LGTM.
Nit: perhaps could use array-ify instead of creating a castArray function.

@sindresorhus
Copy link
Owner

sindresorhus commented Oct 27, 2016

Nit: perhaps could use array-ify instead of creating a castArray function.

Nah. Can just be inlined to [].concat(patterns).

@@ -44,6 +44,10 @@ Returns an array of objects in the format `{ pattern: string, opts: Object }`, w

Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.

### globby.hasMagic(patterns, [options])

See `node-glob` [hasMagic](https://github.com/isaacs/node-glob#globhasmagicpattern-options).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be made clearer that it differentiates by supporting multiple patterns.

@UltCombo
Copy link
Contributor

Nah. Can just be inlined to [].concat(patterns).

That allocates two extra array instances which may be unnecessary. I'm not sure if V8 is smart enough to optimize that, but I guess it doesn't really matter. Your call.

@sindresorhus sindresorhus changed the title expose hasMagic expose .hasMagic() Nov 4, 2016
@sindresorhus sindresorhus merged commit 77dde6d into sindresorhus:master Nov 4, 2016
sindresorhus added a commit that referenced this pull request Nov 4, 2016
@moeriki moeriki deleted the hasMagic branch November 4, 2016 08:15
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

Successfully merging this pull request may close these issues.

4 participants