Skip to content

Commit 35f5a47

Browse files
authored
[INTERNAL] readers/Link: Improve JSDoc (#444)
1 parent c0c1a32 commit 35f5a47

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

lib/readers/Link.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ import logger from "@ui5/logger";
55
const log = logger.getLogger("resources:readers:Link");
66

77
/**
8-
* A reader that allows removing paths segments from all resources passed through it.
8+
* A reader that allows for rewriting paths segments of all resources passed through it.
9+
*
10+
* @example
11+
* import Link from "@ui5/fs/readers/Link";
12+
* const linkedReader = new Link({
13+
* reader: sourceReader,
14+
* pathMapping: {
15+
* linkPath: `/app`,
16+
* targetPath: `/resources/my-app-name/`
17+
* }
18+
* });
19+
*
20+
* // The following resolves with a @ui5/fs/ResourceFacade of the resource
21+
* // located at "/resources/my-app-name/Component.js" in the sourceReader
22+
* const resource = await linkedReader.byPath("/app/Component.js");
923
*
1024
* @public
1125
* @class

lib/resourceFactory.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export function createWriterCollection({name, writerMapping}) {
122122
}
123123

124124
/**
125-
* Creates a <code>Resource</code>. Accepts the same parameters as the Resource constructor.
125+
* Creates a [Resource]{@link @ui5/fs/Resource}.
126+
* Accepts the same parameters as the [Resource]{@link @ui5/fs/Resource} constructor.
126127
*
127128
* @public
128129
* @param {object} parameters Parameters to be passed to the resource constructor
@@ -180,7 +181,21 @@ export function createFilterReader(parameters) {
180181

181182
/**
182183
* Create a [Link-Reader]{@link @ui5/fs/readers/Filter} with the given reader.
183-
* The provided path mapping allows
184+
* The provided path mapping allows for rewriting paths segments of all resources passed through it.
185+
*
186+
* @example
187+
* import {createLinkReader} from "@ui5/fs/resourceFactory";
188+
* const linkedReader = createLinkReader({
189+
* reader: sourceReader,
190+
* pathMapping: {
191+
* linkPath: `/app`,
192+
* targetPath: `/resources/my-app-name/`
193+
* }
194+
* });
195+
*
196+
* // The following resolves with a @ui5/fs/ResourceFacade of the resource
197+
* // located at "/resources/my-app-name/Component.js" in the sourceReader
198+
* const resource = await linkedReader.byPath("/app/Component.js");
184199
*
185200
* @public
186201
* @param {object} parameters

0 commit comments

Comments
 (0)