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

Source Array order not followed #117

Closed
intervalia opened this issue Sep 28, 2018 · 3 comments
Closed

Source Array order not followed #117

intervalia opened this issue Sep 28, 2018 · 3 comments
Assignees

Comments

@intervalia
Copy link

Environment

  • OS Version:Any
  • Node.js Version: Any

Actual behavior

All non-globby names are migrated to the front of the array and all globby names are placed after the non-globby names.

Expected behavior

If I have this array:

[ '*.js', '*.css', 'app.html' ]

Then the resulting file list will have 'app.html' listed first even though I asked for it last.

@mrmlnc mrmlnc self-assigned this Sep 28, 2018
@mrmlnc
Copy link
Owner

mrmlnc commented Sep 28, 2018

Hello, @intervalia,

This is the correct behavior described in the README.md.

This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns.

You can use one of the sorting methods. For example, by .sort.

@intervalia
Copy link
Author

intervalia commented Sep 29, 2018 via email

@mrmlnc
Copy link
Owner

mrmlnc commented Oct 20, 2018

Unfortunately, we cannot guarantee consistency in the current version of the package.

But you can use the hack.

const fg = require('fast-glob');

const first = fg(['app.html']);
const second = fg(['*.js', '*.css']);

Promise.all([first, second]).then(([a, b]) => [].concat(a, b));

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

No branches or pull requests

2 participants