Skip to content

Commit

Permalink
[INTERNAL] Update Reader JSDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Mar 18, 2019
1 parent 5dd313b commit 38ef241
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
21 changes: 11 additions & 10 deletions lib/AbstractReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class AbstractReader {
}

/**
* Locates resourcess by GLOB.
* Locates resources by matching GLOB patterns.
*
* @example
* <caption>Example patterns:</caption>
* // **\u00002F*.{html,htm}
* // **\u00002F.library
* // /pony/*
* byGlob("**‏/*.{html,htm}");
* byGlob("**‏/.library");
* byGlob("/pony/*");
*
* @public
* @param {string|Array} virPattern GLOB pattern as string or array of glob patterns for virtual directory structure
* @param {Object} [options={}] GLOB options
* @param {string|string[]} virPattern GLOB pattern as string or array of glob patterns for
* virtual directory structure
* @param {Object} [options] GLOB options
* @param {boolean} [options.nodir=true] Do not match directories
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving to list of resources
*/
Expand All @@ -54,11 +54,11 @@ class AbstractReader {
}

/**
* Locates resources by path.
* Locates resources by matching a given path.
*
* @public
* @param {string} virPath Virtual path
* @param {Object} options Options
* @param {Object} [options] Options
* @param {boolean} [options.nodir=true] Do not match directories
* @returns {Promise<module:@ui5/fs.Resource>} Promise resolving to a single resource
*/
Expand All @@ -75,7 +75,8 @@ class AbstractReader {
*
* @abstract
* @protected
* @param {string} virPattern GLOB pattern for virtual directory structure
* @param {string|string[]} virPattern GLOB pattern as string or an array of
* glob patterns for virtual directory structure
* @param {Object} options GLOB options
* @param {module:@ui5/fs.tracing.Trace} trace Trace instance
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving to list of resources
Expand Down
8 changes: 5 additions & 3 deletions lib/DuplexCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ class DuplexCollection extends AbstractReaderWriter {
* Locates resources by GLOB.
*
* @private
* @param {string} virPattern GLOB pattern for virtual directory structure
* @param {string|string[]} virPattern GLOB pattern as string or an array of
* glob patterns for virtual directory structure
* @param {Object} options GLOB options
* @param {module:@ui5/fs.tracing.Trace} trace Trace instance
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving with a list of resources
Expand All @@ -49,10 +50,11 @@ class DuplexCollection extends AbstractReaderWriter {
* For found resources that are also available in the writer, the writer resource will be returned.
*
* @param {string} virPattern GLOB pattern for virtual directory structure
* @param {Object} [options={}] GLOB options
* @param {Object} [options] GLOB options
* @param {boolean} [options.nodir=true] Do not match directories
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving to list of resources
*/
byGlobSource(virPattern, options = {}) {
byGlobSource(virPattern, options = {nodir: true}) {
return this._reader.byGlob(virPattern, options).then((resources) => {
return Promise.all(resources.map((readerResource) => {
return this._writer.byPath(readerResource.getPath()).then((writerResource) => {
Expand Down
3 changes: 2 additions & 1 deletion lib/ReaderCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class ReaderCollection extends AbstractReader {
* Locates resources by GLOB.
*
* @private
* @param {string} pattern GLOB pattern
* @param {string|string[]} pattern GLOB pattern as string or an array of
* glob patterns for virtual directory structure
* @param {Object} options GLOB options
* @param {module:@ui5/fs.tracing.Trace} trace Trace instance
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving to list of resources
Expand Down
6 changes: 4 additions & 2 deletions lib/ReaderCollectionPrioritized.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class ReaderCollectionPrioritized extends AbstractReader {
*
* @param {Object} parameters
* @param {string} parameters.name The collection name
* @param {module:@ui5/fs.AbstractReader[]} parameters.readers Prioritized list of resource readers (first is tried first)
* @param {module:@ui5/fs.AbstractReader[]} parameters.readers Prioritized list of resource readers
* (first is tried first)
*/
constructor({readers, name}) {
super();
Expand All @@ -25,7 +26,8 @@ class ReaderCollectionPrioritized extends AbstractReader {
* Locates resources by GLOB.
*
* @private
* @param {string} pattern GLOB pattern
* @param {string|string[]} pattern GLOB pattern as string or an array of
* glob patterns for virtual directory structure
* @param {Object} options GLOB options
* @param {module:@ui5/fs.tracing.Trace} trace Trace instance
* @returns {Promise<module:@ui5/fs.Resource[]>} Promise resolving to list of resources
Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/AbstractAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AbstractAdapter extends AbstractReaderWriter {
*
* @abstract
* @private
* @param {string|Array} virPattern GLOB pattern as string or an array of
* @param {string|string[]} virPattern GLOB pattern as string or an array of
* glob patterns for virtual directory structure
* @param {Object} [options={}] GLOB options
* @param {boolean} [options.nodir=true] Do not match directories
Expand Down
2 changes: 1 addition & 1 deletion lib/adapters/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class FileSystem extends AbstractAdapter {
* @param {string} virPath Virtual path
* @param {Object} options Options
* @param {module:@ui5/fs.tracing.Trace} trace Trace instance
* @returns {Promise<module:@ui5/fs.Resource>} Promise resolving to a single resource
* @returns {Promise<module:@ui5/fs.Resource>} Promise resolving to a single resource or null if not found
*/
_byPath(virPath, options, trace) {
return new Promise((resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion test/lib/DuplexCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ test("DuplexCollection: _byGlobSource with default options and a reader finding
return duplexCollection.byGlobSource("anyPattern")
.then(function(resources) {
t.true(Array.isArray(resources), "Found resources are returned as an array");
t.true(abstractReader.byGlob.calledWithExactly("anyPattern", {}),
t.true(abstractReader.byGlob.calledWithExactly("anyPattern", {nodir: true}),
"Delegated globbing task correctly to readers");
t.true(abstractWriter.byPath.calledWithExactly("my/path"),
"byPath called on writer");
Expand Down

0 comments on commit 38ef241

Please sign in to comment.