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

[FEATURE] Introduce Readers "Filter" and "Transformer" #331

Merged
merged 15 commits into from
Jan 13, 2022

Conversation

RandomByte
Copy link
Member

@RandomByte RandomByte commented Oct 29, 2021

TODOs

  • JSDoc

@coveralls
Copy link

coveralls commented Oct 29, 2021

Coverage Status

Coverage decreased (-0.4%) to 87.372% when pulling 4fca2aa on add-reader-filter into 6dc1723 on next.

@RandomByte RandomByte force-pushed the add-reader-filter branch 2 times, most recently from 2022096 to b7a6080 Compare November 16, 2021 14:29
@RandomByte RandomByte changed the base branch from master to next November 23, 2021 16:57
@RandomByte RandomByte changed the title Introduce ReaderFilter [FEATURE] Introduce ReaderFilter Nov 24, 2021
@RandomByte RandomByte marked this pull request as ready for review December 3, 2021 14:46
lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
test/lib/ReaderFilter.js Outdated Show resolved Hide resolved
Co-authored-by: KlattG <57760635+KlattG@users.noreply.github.com>
KlattG
KlattG previously approved these changes Dec 6, 2021
lib/ReaderFilter.js Outdated Show resolved Hide resolved
lib/AbstractReader.js Show resolved Hide resolved
@@ -70,6 +70,14 @@ class AbstractReader {
});
}

filter(callback) {
const ReaderFilter = require("./ReaderFilter");
Copy link
Member

Choose a reason for hiding this comment

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

Note: Cyclic dependency
This shouldn't cause any issues but we might also just use the "ReaderFilter" directly within ui5-builder.

This should make resource clone operations cheaper since the content
doesn't need to be read and cloned immediately
@RandomByte
Copy link
Member Author

@KlattG I think there's no further review necessary from your side. Thanks

lib/AbstractReader.js Outdated Show resolved Hide resolved
lib/AbstractReader.js Outdated Show resolved Hide resolved
index.js Show resolved Hide resolved
@RandomByte
Copy link
Member Author

RandomByte commented Dec 23, 2021

Copy link

@KlattG KlattG left a comment

Choose a reason for hiding this comment

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

Not sure what the 'T' in Lines 80 & 96 of AbstractReader refers to, I expected some sort of description there.

* @public
* @callback module:@ui5/fs.readers.Filter~callback
* @param {module:@ui5/fs.Resource} resource Resource to test
* @returns {boolean} Return <code>true</code> to keep the resource, or <code>false</code> to disregard it
Copy link

Choose a reason for hiding this comment

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

Suggested change
* @returns {boolean} Return <code>true</code> to keep the resource, or <code>false</code> to disregard it
* @returns {boolean} Whether to keep the resource

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Done

* @public
* @param {module:@ui5/fs.readers.Filter~callback} callback
* Filter function. Will be called for every resource passed through this reader.
* @returns {module:@ui5/fs.reader.Transformer} T
Copy link

Choose a reason for hiding this comment

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

T = ?
... something missing here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

* @public
* @param {module:@ui5/fs.readers.Transformer~callback} callback
* Callback to check and eventually transform any resource passed through the reader
* @returns {module:@ui5/fs.reader.Transformer} T
Copy link

Choose a reason for hiding this comment

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

see above

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@RandomByte RandomByte changed the title [FEATURE] Introduce ReaderFilter [FEATURE] Introduce Readers "Filter" and "Transformer" Jan 13, 2022
@RandomByte RandomByte merged commit f46e6d1 into next Jan 13, 2022
@RandomByte RandomByte deleted the add-reader-filter branch January 13, 2022 16:21
RandomByte added a commit to SAP/ui5-builder that referenced this pull request Jan 14, 2022
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.

None yet

4 participants