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

Handle nested arrays #362

Merged
merged 5 commits into from
Oct 1, 2015
Merged

Handle nested arrays #362

merged 5 commits into from
Oct 1, 2015

Conversation

es128
Copy link
Contributor

@es128 es128 commented Sep 30, 2015

Also adds an explicit error message when bad (non-string or array of strings) input is provided

Resolves #360

@es128 es128 force-pushed the nested-arrays branch 2 times, most recently from 29aabc7 to b210c88 Compare September 30, 2015 21:46
@@ -8,6 +8,8 @@ var globparent = require('glob-parent');
var isglob = require('is-glob');
var arrify = require('arrify');
var isAbsolute = require('path-is-absolute');
var flatten = require('lodash.flatten');
var isString = require('is-string');
Copy link
Owner

Choose a reason for hiding this comment

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

do we really need a separate module for .filter(item => typeof item === 'string')?

@paulmillr
Copy link
Owner

What if we declare flatten, arrify and is-string as three small separate functions inside the main js file?

That would reduce the number of dependencies used by chokidar. I think this is useful esp for our huge user base

@es128
Copy link
Contributor Author

es128 commented Sep 30, 2015

I think we're better off using externally maintained tiny dependencies than redefining them within the lib.

These have way less impact as deps than 1) fsevents, and 2) all the stuff that comes with glob matching.

@paulmillr
Copy link
Owner

looks good other than that

@es128
Copy link
Contributor Author

es128 commented Sep 30, 2015

Actually turns out I broke the test... fixing/rebasing now

@paulmillr
Copy link
Owner

These have way less impact

would be great to see some numbers related to this statement on a big scale. 3 deps = at least 6-12 more https requests.

let's merge this right now though, we can do a research later

@es128
Copy link
Contributor Author

es128 commented Sep 30, 2015

don't merge quite yet, let me turn the CI checks green

@es128
Copy link
Contributor Author

es128 commented Sep 30, 2015

Regarding the deps, I tend to agree with @sindresorhus' perspective

If the size of the dep tree were a major concern, we'd make all sorts of choices differently, like anymatch using micromatch vs minimatch. But I don't think it should be thought of that way. We use modules for any common repeatable utility, even if simple, and just stick to just what we use, avoiding any mega kitchen sink libs.

That said, yeah, maybe is-string in particular is too bloated for what we need here. I guess I'll replace it with a simpler inline implementation.

@phated
Copy link
Contributor

phated commented Sep 30, 2015

is-string seems overkill

@es128
Copy link
Contributor Author

es128 commented Sep 30, 2015

okok it's gone now

paths = arrify(paths);
paths = flatten(arrify(paths));

function isString(maybeString) {
Copy link
Owner

Choose a reason for hiding this comment

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

this would declare it on every add -- more memory usage etc.

Copy link
Owner

Choose a reason for hiding this comment

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

let's move it out of the fn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed 464e85d

paulmillr added a commit that referenced this pull request Oct 1, 2015
@paulmillr paulmillr merged commit 3eb81d6 into master Oct 1, 2015
@es128 es128 deleted the nested-arrays branch October 1, 2015 12:00
@phated
Copy link
Contributor

phated commented Oct 1, 2015

@es128 @paulmillr will 1.2 be released today?

@es128
Copy link
Contributor Author

es128 commented Oct 1, 2015

yup, actually i'll take care of that now

@coveralls
Copy link

Coverage Status

Coverage decreased (-52.3%) to 46.124% when pulling 464e85d on nested-arrays into 327bda1 on master.

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