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

Add base path of entry for objectMode #222

Closed
wants to merge 1 commit into from

Conversation

helloyou2012
Copy link

What is the purpose of this pull request?

For objectMode the base path of entry should be return, otherwise we can't get the base path through the results.

What changes did you make? (Give an overview)

  • add base property for Entry
  • add basePath param for EntryTransformer.getTransformer(basePath: string)

@mrmlnc mrmlnc self-assigned this Aug 17, 2019
@mrmlnc
Copy link
Owner

mrmlnc commented Sep 5, 2019

/azp run benchmark.regression.object

@mrmlnc
Copy link
Owner

mrmlnc commented Sep 5, 2019

/azp run benchmark.regression

@mrmlnc
Copy link
Owner

mrmlnc commented Sep 21, 2019

Can you give me some idea how you will use this opportunity?

@@ -9,7 +9,7 @@ export default class DeepFilter {
const maxPatternDepth = this._getMaxPatternDepth(positive);
const negativeRe = this._getNegativePatternsRe(negative);

return (entry) => this._filter(basePath, entry, negativeRe, maxPatternDepth);
return (entry) => this._filter(basePath, entry as Entry, negativeRe, maxPatternDepth);
Copy link
Owner

Choose a reason for hiding this comment

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

JFYI: When we use the type assertion mechanism we introduce unsafe code. For example, then inside this function we can refer to the base property, which may not be accessible (undefined).

Copy link
Author

Choose a reason for hiding this comment

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

Yes I know, but if not so I have to change fsWalk.Entry or DeepFilterFunction.

@helloyou2012
Copy link
Author

Can you give me some idea how you will use this opportunity?

I want to implement a function like gulp.src:

function copy (src, dest) {
  ...
}
copy(['input/*.js'], 'output');
// input/a.js => output/a.js

@mrmlnc mrmlnc added this to the 3.2.0 milestone Oct 6, 2019
@mrmlnc mrmlnc modified the milestones: 3.2.0, 3.x.x Feb 9, 2020
@mrmlnc
Copy link
Owner

mrmlnc commented Apr 30, 2023

My current vision for the development of this package does not involve adding this field to Entry. If you cannot use path.dirname or always require base, I suggest opening an issue with examples of why this is necessary.

@mrmlnc mrmlnc closed this Apr 30, 2023
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.

2 participants