repository-provider 26.1.0 → 26.1.1

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/README.md CHANGED
@@ -138,6 +138,7 @@ console.log(await readme.getString());
138
138
  * [Parameters](#parameters-28)
139
139
  * [Properties](#properties-5)
140
140
  * [url](#url-1)
141
+ * [refType](#reftype)
141
142
  * [isDefault](#isdefault)
142
143
  * [delete](#delete)
143
144
  * [commit](#commit-2)
@@ -335,6 +336,7 @@ console.log(await readme.getString());
335
336
  * [Parameters](#parameters-82)
336
337
  * [Tag](#tag-1)
337
338
  * [Parameters](#parameters-83)
339
+ * [refType](#reftype-1)
338
340
  * [isWritable](#iswritable-1)
339
341
  * [asArray](#asarray)
340
342
  * [Parameters](#parameters-84)
@@ -564,7 +566,7 @@ Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Gl
564
566
 
565
567
  ### normalizeRepositoryName
566
568
 
567
- Bring a repository name into its normal form by removing any clutter
569
+ Bring a repository name into its normal form by removing any clutter.
568
570
  like .git suffix or #branch names.
569
571
 
570
572
  #### Parameters
@@ -576,7 +578,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
576
578
 
577
579
  ### normalizeGroupName
578
580
 
579
- Bring a group name into its normal form by removing any clutter
581
+ Bring a group name into its normal form by removing any clutter.
580
582
  like .git suffix or #branch names.
581
583
 
582
584
  #### Parameters
@@ -588,7 +590,7 @@ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
588
590
 
589
591
  ### areRepositoryNamesCaseSensitive
590
592
 
591
- Are repositroy names case sensitive.
593
+ Are repository names case sensitive.
592
594
  Overwrite and return false if you want to have case insensitive repository lookup
593
595
 
594
596
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true
@@ -853,6 +855,10 @@ Deliver repository and branch url combined.
853
855
 
854
856
  Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 'repoUrl#branch'
855
857
 
858
+ ### refType
859
+
860
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tags
861
+
856
862
  ### isDefault
857
863
 
858
864
  Are we the default branch.
@@ -1954,6 +1960,10 @@ Tag refs
1954
1960
  * `name`
1955
1961
  * `options`
1956
1962
 
1963
+ ### refType
1964
+
1965
+ Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** tags
1966
+
1957
1967
  ### isWritable
1958
1968
 
1959
1969
  Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repository-provider",
3
- "version": "26.1.0",
3
+ "version": "26.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "ava": "^3.15.0",
37
37
  "c8": "^7.11.0",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^1.9.0",
39
+ "repository-provider-test-support": "^1.9.1",
40
40
  "semantic-release": "^18.0.1",
41
41
  "typescript": "^4.6.0-dev.20211230"
42
42
  },
package/src/attribute.mjs CHANGED
@@ -46,8 +46,8 @@ export function definePropertiesFromOptions(
46
46
 
47
47
  let value = options[name];
48
48
  if (value === undefined) {
49
- if (typeof attribute.default === "function") {
50
- value = attribute.default(attribute, object);
49
+ if (attribute.getDefault) {
50
+ value = attribute.getDefault(attribute, object);
51
51
  } else if (
52
52
  attribute.default !== undefined &&
53
53
  attribute.default !== getAttribute(object, name)
@@ -102,6 +102,26 @@ export function definePropertiesFromOptions(
102
102
  Object.assign(object, applyLater);
103
103
  }
104
104
 
105
+ /**
106
+ * get default values.
107
+ * @param {Object} attributes
108
+ * @return {Object} filled with default values
109
+ */
110
+ export function defaultValues(attributes) {
111
+ Object.entries(attributes).reduce((a, c) => {
112
+ const [name, attribute] = c;
113
+ if (attribute.default !== undefined) {
114
+ a.push([
115
+ name,
116
+ typeof attribute.getDefault
117
+ ? attribute.getDefault(attribute, object)
118
+ : attribute.default
119
+ ]);
120
+ }
121
+ return a;
122
+ }, []);
123
+ }
124
+
105
125
  /**
106
126
  * Set Object attribute.
107
127
  * The name may be a property path like 'a.b.c'.