repository-provider 32.7.11 → 32.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "32.7.11",
3
+ "version": "32.7.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -103,6 +103,7 @@ export function definePropertiesFromOptions(
103
103
  /**
104
104
  * Get default values.
105
105
  * @param {Object} attributes
106
+ * @param {Object} object
106
107
  * @return {Object} filled with default values
107
108
  */
108
109
  export function defaultValues(attributes, object) {
@@ -154,7 +155,7 @@ export function optionJSON(
154
155
  * ```js
155
156
  * mapAttributes({a:1},{a:"a'"}) // {"a'": 1}
156
157
  * ```
157
- * @param {Object} object
158
+ * @param {Object|undefined} object
158
159
  * @param {Object} mapping
159
160
  * @return {Object} keys renamed after mapping
160
161
  */
@@ -177,7 +178,7 @@ export function mapAttributes(object, mapping) {
177
178
  * Same as mapAttributes but with the inverse mapping.
178
179
  * Filters out null, undefined and empty strings
179
180
  * @param {Object} object
180
- * @param {Object} mapping
181
+ * @param {Object|undefined} mapping
181
182
  * @return {Object} keys renamed after mapping
182
183
  */
183
184
  export function mapAttributesInverse(object, mapping) {
@@ -118,7 +118,7 @@ export class Repository extends OwnedObject {
118
118
  /**
119
119
  * Get exactly one matching entry by name or undefined if no such entry is found.
120
120
  * @param {string} name
121
- * @return {Promise<ContentEntry>}
121
+ * @return {Promise<ContentEntry|undefined>}
122
122
  */
123
123
  async maybeEntry(name) {
124
124
  return (await this.defaultBranch).maybeEntry(name);
@@ -198,7 +198,7 @@ export class Repository extends OwnedObject {
198
198
 
199
199
  /**
200
200
  * Lookup the default branch.
201
- * @return {Promise<Branch>} branch named after defaultBranchName
201
+ * @return {Promise<Branch|undefined>} branch named after defaultBranchName
202
202
  */
203
203
  get defaultBranch() {
204
204
  return this.branch(this.defaultBranchName);
package/src/util.mjs CHANGED
@@ -3,7 +3,7 @@ import { Repository } from "./repository.mjs";
3
3
  /**
4
4
  * Convert scalar into an array.
5
5
  * The value undefined will be represented as an empty array.
6
- * @param {any|Array} value
6
+ * @param {Array|any} value
7
7
  * @return {Array} value encapsulated in an array
8
8
  */
9
9
  export function asArray(value) {
@@ -13,25 +13,25 @@ export function asArray(value) {
13
13
  /**
14
14
  * Strip repository base name away.
15
15
  * A URL auth component will be removed to.
16
- * @param {string} name
16
+ * @param {string|undefined} name
17
17
  * @param {string[]} repositoryBases all possible bases
18
18
  * @param {Function} [whenFound] to be called with the found base name
19
- * @return {string} name without base
19
+ * @return {string|undefined} name without base
20
20
  */
21
21
  export function stripBaseName(name, repositoryBases, whenFound) {
22
- if(name) {
23
- for (const b of repositoryBases) {
24
- const m = name.match(/^(\w+:)\/\/([^@]+@)/);
25
- if (m) {
26
- name = m[1] + "//" + name.substring(m[1].length + 2 + m[2].length);
27
- }
22
+ if (name) {
23
+ for (const b of repositoryBases) {
24
+ const m = name.match(/^(\w+:)\/\/([^@]+@)/);
25
+ if (m) {
26
+ name = m[1] + "//" + name.substring(m[1].length + 2 + m[2].length);
27
+ }
28
28
 
29
- if (name.startsWith(b)) {
30
- whenFound?.(b);
31
- return name.slice(b.length);
29
+ if (name.startsWith(b)) {
30
+ whenFound?.(b);
31
+ return name.slice(b.length);
32
+ }
32
33
  }
33
34
  }
34
- }
35
35
  return name;
36
36
  }
37
37
 
@@ -63,5 +63,5 @@ export async function generateBranchName(repository, pattern) {
63
63
  n++;
64
64
  }
65
65
 
66
- return pattern.replace(/\*/, n.toString());
66
+ return pattern.replace(/\*+/, n.toString());
67
67
  }