repository-provider 26.4.3 → 26.4.4

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": "26.4.3",
3
+ "version": "26.4.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,15 +30,15 @@
30
30
  "lint:tsc": "tsc --allowJs --checkJs --noEmit -module nodenext -t es2022 ./src/*.mjs"
31
31
  },
32
32
  "dependencies": {
33
- "matching-iterator": "^2.0.1"
33
+ "matching-iterator": "^2.0.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "ava": "^4.0.1",
37
37
  "c8": "^7.11.0",
38
38
  "documentation": "^13.2.5",
39
- "repository-provider-test-support": "^1.9.9",
39
+ "repository-provider-test-support": "^1.11.1",
40
40
  "semantic-release": "^19.0.2",
41
- "typescript": "^4.6.0-dev.20220126"
41
+ "typescript": "^4.6.0-dev.20220131"
42
42
  },
43
43
  "engines": {
44
44
  "node": ">=14.18.3"
package/src/attribute.mjs CHANGED
@@ -34,69 +34,67 @@ export function definePropertiesFromOptions(
34
34
  object,
35
35
  options = {},
36
36
  properties = {},
37
- attributes = object.constructor.attributes
37
+ attributes = object.constructor.attributes || []
38
38
  ) {
39
39
  const applyLater = {};
40
40
 
41
- if (attributes !== undefined) {
42
- Object.entries(attributes).forEach(([name, attribute]) => {
43
- const path = name.split(/\./);
44
- const first = path.shift();
45
- const property = properties[first];
46
-
47
- let value = options[name];
48
- if (value === undefined) {
49
- if (attribute.getDefault) {
50
- value = attribute.getDefault(attribute, object);
51
- } else if (
52
- attribute.default !== undefined &&
53
- attribute.default !== getAttribute(object, name)
54
- ) {
55
- value = attribute.default;
56
- }
41
+ Object.entries(attributes).forEach(([name, attribute]) => {
42
+ const path = name.split(/\./);
43
+ const first = path.shift();
44
+ const property = properties[first];
45
+
46
+ let value = options[name];
47
+ if (value === undefined) {
48
+ if (attribute.getDefault) {
49
+ value = attribute.getDefault(attribute, object);
50
+ } else if (
51
+ attribute.default !== undefined &&
52
+ attribute.default !== getAttribute(object, name)
53
+ ) {
54
+ value = attribute.default;
57
55
  }
56
+ }
58
57
 
59
- if (attribute.set) {
60
- value = attribute.set(value);
61
- } else {
62
- switch (attribute.type) {
63
- case "boolean":
64
- if (value !== undefined) {
65
- value =
66
- value === 0 || value === "0" || value === false ? false : true;
67
- }
68
- break;
69
- }
58
+ if (attribute.set) {
59
+ value = attribute.set(value);
60
+ } else {
61
+ switch (attribute.type) {
62
+ case "boolean":
63
+ if (value !== undefined) {
64
+ value =
65
+ value === 0 || value === "0" || value === false ? false : true;
66
+ }
67
+ break;
70
68
  }
69
+ }
71
70
 
72
- if (path.length) {
73
- const remaining = path.join(".");
74
- if (property) {
75
- setAttribute(property.value, remaining, value);
76
- } else {
77
- const slice = {};
78
- setAttribute(slice, remaining, value);
79
- properties[first] = { configurable: true, value: slice };
80
- }
71
+ if (path.length) {
72
+ const remaining = path.join(".");
73
+ if (property) {
74
+ setAttribute(property.value, remaining, value);
81
75
  } else {
82
- if (value !== undefined) {
83
- const op = Object.getOwnPropertyDescriptor(
84
- object.constructor.prototype,
85
- first
76
+ const slice = {};
77
+ setAttribute(slice, remaining, value);
78
+ properties[first] = { configurable: true, value: slice };
79
+ }
80
+ } else {
81
+ if (value !== undefined) {
82
+ const op = Object.getOwnPropertyDescriptor(
83
+ object.constructor.prototype,
84
+ first
85
+ );
86
+
87
+ if ((op && op.set) || (property && property.set)) {
88
+ applyLater[first] = value;
89
+ } else {
90
+ properties[first] = Object.assign(
91
+ { value, writable: attribute.writable },
92
+ property
86
93
  );
87
-
88
- if ((op && op.set) || (property && property.set)) {
89
- applyLater[first] = value;
90
- } else {
91
- properties[first] = Object.assign(
92
- { value, writable: attribute.writable },
93
- property
94
- );
95
- }
96
94
  }
97
95
  }
98
- });
99
- }
96
+ }
97
+ });
100
98
 
101
99
  Object.defineProperties(object, properties);
102
100
  Object.assign(object, applyLater);
@@ -114,8 +112,7 @@ export function defaultValues(attributes, object) {
114
112
 
115
113
  if (attribute.default !== undefined) {
116
114
  a.push([name, attribute.default]);
117
- }
118
- else if (attribute.getDefault !== undefined) {
115
+ } else if (attribute.getDefault !== undefined) {
119
116
  a.push([name, attribute.getDefault(attribute, object)]);
120
117
  }
121
118
 
@@ -50,9 +50,7 @@ export class MultiGroupProvider extends BaseProvider {
50
50
  if (rg !== undefined) {
51
51
  const r = await rg.repository(repository);
52
52
  if (r !== undefined) {
53
- return r.branch(
54
- branch === undefined ? r.defaultBranchName : branch
55
- );
53
+ return r.branch( r.defaultBranchName || branch);
56
54
  }
57
55
  }
58
56
  }