@github/browser-support 4.2.3 → 4.4.0
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 +23 -0
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -2
- package/lib/index.js.map +1 -1
- package/lib/iterator-helpers.d.ts +4 -0
- package/lib/iterator-helpers.d.ts.map +1 -0
- package/lib/iterator-helpers.js +381 -0
- package/lib/iterator-helpers.js.map +1 -0
- package/lib/map-groupby.d.ts +5 -0
- package/lib/map-groupby.d.ts.map +1 -0
- package/lib/map-groupby.js +29 -0
- package/lib/map-groupby.js.map +1 -0
- package/lib/object-groupby.d.ts +5 -0
- package/lib/object-groupby.d.ts.map +1 -0
- package/lib/object-groupby.js +29 -0
- package/lib/object-groupby.js.map +1 -0
- package/lib/promise-try.d.ts +5 -0
- package/lib/promise-try.d.ts.map +1 -0
- package/lib/promise-try.js +18 -0
- package/lib/promise-try.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -36,6 +36,29 @@ npm install
|
|
|
36
36
|
npm test
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Upgrading browser-support in Dotcom
|
|
40
|
+
|
|
41
|
+
During upgrades, it is crucial to ensure that browser error reporting to Sentry is not disrupted. Use the following steps to validate this functionality:
|
|
42
|
+
|
|
43
|
+
### Review lab testing
|
|
44
|
+
- Create a PR to upgrade the `browser-support` version in Dotcom.
|
|
45
|
+
- Trigger a browser error from your `review-lab` instance and confirm it is reported in Sentry:
|
|
46
|
+
- Append `#b00m` to your `review-lab` URL (e.g. `https://branchname.review-lab.github.com#b00m`) and refresh the page.
|
|
47
|
+
- Confirm the error is reported in [review-lab Sentry](https://github.sentry.io/issues/?environment=review-lab&groupStatsPeriod=auto&project=1890375&query=b00m&referrer=issue-list&statsPeriod=5m).
|
|
48
|
+
- Perform these steps in Chrome, Firefox, Edge, and Opera. Note: Errors are currently not reported in Safari due to an [open issue](https://github.com/github/web-systems/issues/3162).
|
|
49
|
+
|
|
50
|
+
### Production deployment
|
|
51
|
+
|
|
52
|
+
- Check the [browser-reporting](https://app.datadoghq.com/monitors/168685099) monitor.
|
|
53
|
+
- If the rate of reported browser errors drops, the monitor will trigger an alert in the [#web-systems-ops](https://github-grid.enterprise.slack.com/archives/C046W1V95FV) channel.
|
|
54
|
+
- After deploying to canary:
|
|
55
|
+
- Trigger a browser error by appending `#b00m` to your URL.
|
|
56
|
+
- Confirm the error is reported in [canary Sentry](https://github.sentry.io/issues/?environment=canary&groupStatsPeriod=auto&project=1890375&query=b00m&referrer=issue-list&statsPeriod=5m).
|
|
57
|
+
- After deploying to production:
|
|
58
|
+
- Trigger a browser error by appending `#b00m` to your URL.
|
|
59
|
+
- Confirm the error is reported in [production Sentry](https://github.sentry.io/issues/?environment=production&groupStatsPeriod=auto&project=1890375&query=b00m&referrer=issue-list&statsPeriod=5m).
|
|
60
|
+
- Check the [browser-reporting monitor](https://app.datadoghq.com/monitors/168685099) to ensure there are no anomalies in the error reporting rate.
|
|
61
|
+
|
|
39
62
|
## Contributing
|
|
40
63
|
|
|
41
64
|
### Adding polyfills
|
package/lib/index.d.ts
CHANGED
|
@@ -4,8 +4,11 @@ import * as navigatorClipboard from './navigator-clipboard.js';
|
|
|
4
4
|
import * as withResolvers from './promise-withResolvers.js';
|
|
5
5
|
import * as requestIdleCallback from './requestidlecallback.js';
|
|
6
6
|
import * as popover from '@oddbird/popover-polyfill/fn';
|
|
7
|
-
import * as dialogToggleEvents from 'dialog-toggle-events-polyfill/fn';
|
|
8
7
|
import * as commandAndCommandFor from 'invokers-polyfill/fn';
|
|
8
|
+
import * as objectGroupBy from './object-groupby.js';
|
|
9
|
+
import * as mapGroupBy from './map-groupby.js';
|
|
10
|
+
import * as promiseTry from './promise-try.js';
|
|
11
|
+
import * as iteratorHelpers from './iterator-helpers.js';
|
|
9
12
|
export declare const baseSupport: boolean;
|
|
10
13
|
export declare const polyfills: {
|
|
11
14
|
clipboardItem: typeof clipboardItem;
|
|
@@ -14,8 +17,11 @@ export declare const polyfills: {
|
|
|
14
17
|
requestIdleCallback: typeof requestIdleCallback;
|
|
15
18
|
withResolvers: typeof withResolvers;
|
|
16
19
|
popover: typeof popover;
|
|
17
|
-
dialogToggleEvents: typeof dialogToggleEvents;
|
|
18
20
|
commandAndCommandFor: typeof commandAndCommandFor;
|
|
21
|
+
objectGroupBy: typeof objectGroupBy;
|
|
22
|
+
mapGroupBy: typeof mapGroupBy;
|
|
23
|
+
promiseTry: typeof promiseTry;
|
|
24
|
+
iteratorHelpers: typeof iteratorHelpers;
|
|
19
25
|
};
|
|
20
26
|
export declare function isSupported(): boolean;
|
|
21
27
|
export declare function isPolyfilled(): boolean;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,kBAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,oBAAoB,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AAUxD,eAAO,MAAM,WAAW,SA6BlB,CAAA;AAEN,eAAO,MAAM,SAAS;;;;;;;;;;;;CAYrB,CAAA;AAED,wBAAgB,WAAW,YAE1B;AAED,wBAAgB,YAAY,YAE3B;AAED,wBAAgB,KAAK,SAIpB"}
|
package/lib/index.js
CHANGED
|
@@ -4,8 +4,11 @@ import * as navigatorClipboard from './navigator-clipboard.js';
|
|
|
4
4
|
import * as withResolvers from './promise-withResolvers.js';
|
|
5
5
|
import * as requestIdleCallback from './requestidlecallback.js';
|
|
6
6
|
import * as popover from '@oddbird/popover-polyfill/fn';
|
|
7
|
-
import * as dialogToggleEvents from 'dialog-toggle-events-polyfill/fn';
|
|
8
7
|
import * as commandAndCommandFor from 'invokers-polyfill/fn';
|
|
8
|
+
import * as objectGroupBy from './object-groupby.js';
|
|
9
|
+
import * as mapGroupBy from './map-groupby.js';
|
|
10
|
+
import * as promiseTry from './promise-try.js';
|
|
11
|
+
import * as iteratorHelpers from './iterator-helpers.js';
|
|
9
12
|
let supportsModalPseudo = false;
|
|
10
13
|
try {
|
|
11
14
|
// This will error in older browsers
|
|
@@ -50,8 +53,11 @@ export const polyfills = {
|
|
|
50
53
|
requestIdleCallback,
|
|
51
54
|
withResolvers,
|
|
52
55
|
popover,
|
|
53
|
-
dialogToggleEvents,
|
|
54
56
|
commandAndCommandFor,
|
|
57
|
+
objectGroupBy,
|
|
58
|
+
mapGroupBy,
|
|
59
|
+
promiseTry,
|
|
60
|
+
iteratorHelpers,
|
|
55
61
|
};
|
|
56
62
|
export function isSupported() {
|
|
57
63
|
return baseSupport && Object.values(polyfills).every(polyfill => polyfill.isSupported());
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,kBAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,oBAAoB,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AAExD,IAAI,mBAAmB,GAAG,KAAK,CAAA;AAC/B,IAAI;IACF,oCAAoC;IACpC,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAA;CAChE;AAAC,MAAM;IACN,mBAAmB,GAAG,KAAK,CAAA;C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CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;AAC5E,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC/C,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YAAE,QAAQ,CAAC,KAAK,EAAE,CAAA;KAC9C;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterator-helpers.d.ts","sourceRoot":"","sources":["../src/iterator-helpers.ts"],"names":[],"mappings":"AA6SA,wBAAgB,WAAW,IAAI,OAAO,CAqBrC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CA+BtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAmD5B"}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
// Get the Iterator prototype
|
|
2
|
+
/*#__PURE__*/
|
|
3
|
+
function getIteratorPrototype() {
|
|
4
|
+
try {
|
|
5
|
+
// Derive IteratorPrototype from the Array iterator prototype chain.
|
|
6
|
+
// This avoids dynamic evaluation and works under strict CSP.
|
|
7
|
+
if (typeof Symbol !== 'function' || typeof Symbol.iterator !== 'symbol') {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
const arrayIter = [][Symbol.iterator]();
|
|
11
|
+
const arrayIterProto = Object.getPrototypeOf(arrayIter);
|
|
12
|
+
if (!arrayIterProto)
|
|
13
|
+
return null;
|
|
14
|
+
return Object.getPrototypeOf(arrayIterProto);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Fallback prototype used when native IteratorPrototype cannot be discovered.
|
|
21
|
+
// Helper-produced iterators inherit from this so that method chaining still
|
|
22
|
+
// works even in environments where getIteratorPrototype() returns null.
|
|
23
|
+
const helperPrototype = {};
|
|
24
|
+
/*#__PURE__*/
|
|
25
|
+
function map(mapper) {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
27
|
+
const iterator = this;
|
|
28
|
+
let index = 0;
|
|
29
|
+
const iteratorPrototype = getIteratorPrototype();
|
|
30
|
+
const result = Object.create(iteratorPrototype || helperPrototype);
|
|
31
|
+
result.next = function () {
|
|
32
|
+
const res = iterator.next();
|
|
33
|
+
if (res.done) {
|
|
34
|
+
return { done: true, value: undefined };
|
|
35
|
+
}
|
|
36
|
+
return { done: false, value: mapper(res.value, index++) };
|
|
37
|
+
};
|
|
38
|
+
result.return = function (value) {
|
|
39
|
+
if (iterator.return) {
|
|
40
|
+
iterator.return();
|
|
41
|
+
}
|
|
42
|
+
return { done: true, value };
|
|
43
|
+
};
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
/*#__PURE__*/
|
|
47
|
+
function filter(predicate) {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
49
|
+
const iterator = this;
|
|
50
|
+
let index = 0;
|
|
51
|
+
const iteratorPrototype = getIteratorPrototype();
|
|
52
|
+
const result = Object.create(iteratorPrototype || helperPrototype);
|
|
53
|
+
result.next = function () {
|
|
54
|
+
// eslint-disable-next-line no-constant-condition
|
|
55
|
+
while (true) {
|
|
56
|
+
const res = iterator.next();
|
|
57
|
+
if (res.done) {
|
|
58
|
+
return { done: true, value: undefined };
|
|
59
|
+
}
|
|
60
|
+
if (predicate(res.value, index++)) {
|
|
61
|
+
return res;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
result.return = function (value) {
|
|
66
|
+
if (iterator.return) {
|
|
67
|
+
iterator.return();
|
|
68
|
+
}
|
|
69
|
+
return { done: true, value };
|
|
70
|
+
};
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
function take(limit) {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
76
|
+
const iterator = this;
|
|
77
|
+
let remaining = limit;
|
|
78
|
+
const iteratorPrototype = getIteratorPrototype();
|
|
79
|
+
const result = Object.create(iteratorPrototype || helperPrototype);
|
|
80
|
+
result.next = function () {
|
|
81
|
+
if (remaining <= 0) {
|
|
82
|
+
if (iterator.return) {
|
|
83
|
+
iterator.return();
|
|
84
|
+
}
|
|
85
|
+
return { done: true, value: undefined };
|
|
86
|
+
}
|
|
87
|
+
remaining--;
|
|
88
|
+
return iterator.next();
|
|
89
|
+
};
|
|
90
|
+
result.return = function (value) {
|
|
91
|
+
if (iterator.return) {
|
|
92
|
+
iterator.return();
|
|
93
|
+
}
|
|
94
|
+
return { done: true, value };
|
|
95
|
+
};
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
/*#__PURE__*/
|
|
99
|
+
function drop(limit) {
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
101
|
+
const iterator = this;
|
|
102
|
+
let remaining = limit;
|
|
103
|
+
const iteratorPrototype = getIteratorPrototype();
|
|
104
|
+
const result = Object.create(iteratorPrototype || helperPrototype);
|
|
105
|
+
result.next = function () {
|
|
106
|
+
while (remaining > 0) {
|
|
107
|
+
const res = iterator.next();
|
|
108
|
+
if (res.done) {
|
|
109
|
+
return { done: true, value: undefined };
|
|
110
|
+
}
|
|
111
|
+
remaining--;
|
|
112
|
+
}
|
|
113
|
+
return iterator.next();
|
|
114
|
+
};
|
|
115
|
+
result.return = function (value) {
|
|
116
|
+
if (iterator.return) {
|
|
117
|
+
iterator.return();
|
|
118
|
+
}
|
|
119
|
+
return { done: true, value };
|
|
120
|
+
};
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
/*#__PURE__*/
|
|
124
|
+
function flatMap(mapper) {
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
126
|
+
const iterator = this;
|
|
127
|
+
let index = 0;
|
|
128
|
+
let innerIterator = null;
|
|
129
|
+
const iteratorPrototype = getIteratorPrototype();
|
|
130
|
+
const result = Object.create(iteratorPrototype || helperPrototype);
|
|
131
|
+
result.next = function () {
|
|
132
|
+
// eslint-disable-next-line no-constant-condition
|
|
133
|
+
while (true) {
|
|
134
|
+
if (innerIterator) {
|
|
135
|
+
const res = innerIterator.next();
|
|
136
|
+
if (!res.done) {
|
|
137
|
+
return res;
|
|
138
|
+
}
|
|
139
|
+
innerIterator = null;
|
|
140
|
+
}
|
|
141
|
+
const res = iterator.next();
|
|
142
|
+
if (res.done) {
|
|
143
|
+
return { done: true, value: undefined };
|
|
144
|
+
}
|
|
145
|
+
const mapped = mapper(res.value, index++);
|
|
146
|
+
innerIterator = Symbol.iterator in mapped ? mapped[Symbol.iterator]() : mapped;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
result.return = function (value) {
|
|
150
|
+
if (innerIterator?.return) {
|
|
151
|
+
innerIterator.return();
|
|
152
|
+
}
|
|
153
|
+
if (iterator.return) {
|
|
154
|
+
iterator.return();
|
|
155
|
+
}
|
|
156
|
+
return { done: true, value };
|
|
157
|
+
};
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
/*#__PURE__*/
|
|
161
|
+
function reduce(reducer, ...rest) {
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
163
|
+
const iterator = this;
|
|
164
|
+
let index = 0;
|
|
165
|
+
let accumulator;
|
|
166
|
+
// Use rest.length to reliably detect whether an initialValue was provided,
|
|
167
|
+
// including the case where undefined is intentionally passed as initialValue.
|
|
168
|
+
if (rest.length === 0) {
|
|
169
|
+
const result = iterator.next();
|
|
170
|
+
if (result.done) {
|
|
171
|
+
throw new TypeError('Reduce of empty iterator with no initial value');
|
|
172
|
+
}
|
|
173
|
+
accumulator = result.value;
|
|
174
|
+
index = 1;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
accumulator = rest[0];
|
|
178
|
+
}
|
|
179
|
+
// eslint-disable-next-line no-constant-condition
|
|
180
|
+
while (true) {
|
|
181
|
+
const result = iterator.next();
|
|
182
|
+
if (result.done) {
|
|
183
|
+
return accumulator;
|
|
184
|
+
}
|
|
185
|
+
accumulator = reducer(accumulator, result.value, index++);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/*#__PURE__*/
|
|
189
|
+
function toArray() {
|
|
190
|
+
const result = [];
|
|
191
|
+
// eslint-disable-next-line no-constant-condition
|
|
192
|
+
while (true) {
|
|
193
|
+
const next = this.next();
|
|
194
|
+
if (next.done) {
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
result.push(next.value);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/*#__PURE__*/
|
|
201
|
+
function forEach(callback) {
|
|
202
|
+
let index = 0;
|
|
203
|
+
// eslint-disable-next-line no-constant-condition
|
|
204
|
+
while (true) {
|
|
205
|
+
const result = this.next();
|
|
206
|
+
if (result.done) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
callback(result.value, index++);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/*#__PURE__*/
|
|
213
|
+
function some(predicate) {
|
|
214
|
+
let index = 0;
|
|
215
|
+
// eslint-disable-next-line no-constant-condition
|
|
216
|
+
while (true) {
|
|
217
|
+
const result = this.next();
|
|
218
|
+
if (result.done) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
if (predicate(result.value, index++)) {
|
|
222
|
+
if (this.return) {
|
|
223
|
+
this.return();
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/*#__PURE__*/
|
|
230
|
+
function every(predicate) {
|
|
231
|
+
let index = 0;
|
|
232
|
+
// eslint-disable-next-line no-constant-condition
|
|
233
|
+
while (true) {
|
|
234
|
+
const result = this.next();
|
|
235
|
+
if (result.done) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
if (!predicate(result.value, index++)) {
|
|
239
|
+
if (this.return) {
|
|
240
|
+
this.return();
|
|
241
|
+
}
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/*#__PURE__*/
|
|
247
|
+
function find(predicate) {
|
|
248
|
+
let index = 0;
|
|
249
|
+
// eslint-disable-next-line no-constant-condition
|
|
250
|
+
while (true) {
|
|
251
|
+
const result = this.next();
|
|
252
|
+
if (result.done) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
if (predicate(result.value, index++)) {
|
|
256
|
+
if (this.return) {
|
|
257
|
+
this.return();
|
|
258
|
+
}
|
|
259
|
+
return result.value;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/*#__PURE__*/
|
|
264
|
+
function iteratorFrom(obj) {
|
|
265
|
+
if (obj != null) {
|
|
266
|
+
// Check for iterator (an object with a .next method)
|
|
267
|
+
if (typeof obj === 'object' && 'next' in obj && typeof obj.next === 'function') {
|
|
268
|
+
return obj;
|
|
269
|
+
}
|
|
270
|
+
// Box primitives (e.g. strings) so we can check Symbol.iterator on them
|
|
271
|
+
const iterable = Object(obj);
|
|
272
|
+
if (Symbol.iterator in iterable && typeof iterable[Symbol.iterator] === 'function') {
|
|
273
|
+
return iterable[Symbol.iterator]();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
throw new TypeError('Object is not an iterator or iterable');
|
|
277
|
+
}
|
|
278
|
+
/*#__PURE__*/
|
|
279
|
+
export function isSupported() {
|
|
280
|
+
const IteratorPrototype = getIteratorPrototype();
|
|
281
|
+
const IteratorConstructor = globalThis.Iterator;
|
|
282
|
+
return (IteratorPrototype !== null &&
|
|
283
|
+
'map' in IteratorPrototype &&
|
|
284
|
+
'filter' in IteratorPrototype &&
|
|
285
|
+
'take' in IteratorPrototype &&
|
|
286
|
+
'drop' in IteratorPrototype &&
|
|
287
|
+
'flatMap' in IteratorPrototype &&
|
|
288
|
+
'reduce' in IteratorPrototype &&
|
|
289
|
+
'toArray' in IteratorPrototype &&
|
|
290
|
+
'forEach' in IteratorPrototype &&
|
|
291
|
+
'some' in IteratorPrototype &&
|
|
292
|
+
'every' in IteratorPrototype &&
|
|
293
|
+
'find' in IteratorPrototype &&
|
|
294
|
+
IteratorConstructor !== undefined &&
|
|
295
|
+
typeof IteratorConstructor === 'object' &&
|
|
296
|
+
IteratorConstructor !== null &&
|
|
297
|
+
'from' in IteratorConstructor);
|
|
298
|
+
}
|
|
299
|
+
/*#__PURE__*/
|
|
300
|
+
export function isPolyfilled() {
|
|
301
|
+
const IteratorPrototype = getIteratorPrototype();
|
|
302
|
+
const IteratorConstructor = globalThis.Iterator;
|
|
303
|
+
return (IteratorPrototype !== null &&
|
|
304
|
+
'map' in IteratorPrototype &&
|
|
305
|
+
IteratorPrototype.map === map &&
|
|
306
|
+
'filter' in IteratorPrototype &&
|
|
307
|
+
IteratorPrototype.filter === filter &&
|
|
308
|
+
'take' in IteratorPrototype &&
|
|
309
|
+
IteratorPrototype.take === take &&
|
|
310
|
+
'drop' in IteratorPrototype &&
|
|
311
|
+
IteratorPrototype.drop === drop &&
|
|
312
|
+
'flatMap' in IteratorPrototype &&
|
|
313
|
+
IteratorPrototype.flatMap === flatMap &&
|
|
314
|
+
'reduce' in IteratorPrototype &&
|
|
315
|
+
IteratorPrototype.reduce === reduce &&
|
|
316
|
+
'toArray' in IteratorPrototype &&
|
|
317
|
+
IteratorPrototype.toArray === toArray &&
|
|
318
|
+
'forEach' in IteratorPrototype &&
|
|
319
|
+
IteratorPrototype.forEach === forEach &&
|
|
320
|
+
'some' in IteratorPrototype &&
|
|
321
|
+
IteratorPrototype.some === some &&
|
|
322
|
+
'every' in IteratorPrototype &&
|
|
323
|
+
IteratorPrototype.every === every &&
|
|
324
|
+
'find' in IteratorPrototype &&
|
|
325
|
+
IteratorPrototype.find === find &&
|
|
326
|
+
IteratorConstructor !== undefined &&
|
|
327
|
+
'from' in IteratorConstructor &&
|
|
328
|
+
IteratorConstructor.from === iteratorFrom);
|
|
329
|
+
}
|
|
330
|
+
export function apply() {
|
|
331
|
+
if (isSupported())
|
|
332
|
+
return;
|
|
333
|
+
const IteratorPrototype = getIteratorPrototype();
|
|
334
|
+
// Install methods on the native IteratorPrototype when available, falling
|
|
335
|
+
// back to helperPrototype so that iterators produced by helpers can still
|
|
336
|
+
// chain even when the native prototype cannot be discovered.
|
|
337
|
+
const targetPrototype = (IteratorPrototype || helperPrototype);
|
|
338
|
+
if (!('map' in targetPrototype)) {
|
|
339
|
+
Object.assign(targetPrototype, { map });
|
|
340
|
+
}
|
|
341
|
+
if (!('filter' in targetPrototype)) {
|
|
342
|
+
Object.assign(targetPrototype, { filter });
|
|
343
|
+
}
|
|
344
|
+
if (!('take' in targetPrototype)) {
|
|
345
|
+
Object.assign(targetPrototype, { take });
|
|
346
|
+
}
|
|
347
|
+
if (!('drop' in targetPrototype)) {
|
|
348
|
+
Object.assign(targetPrototype, { drop });
|
|
349
|
+
}
|
|
350
|
+
if (!('flatMap' in targetPrototype)) {
|
|
351
|
+
Object.assign(targetPrototype, { flatMap });
|
|
352
|
+
}
|
|
353
|
+
if (!('reduce' in targetPrototype)) {
|
|
354
|
+
Object.assign(targetPrototype, { reduce });
|
|
355
|
+
}
|
|
356
|
+
if (!('toArray' in targetPrototype)) {
|
|
357
|
+
Object.assign(targetPrototype, { toArray });
|
|
358
|
+
}
|
|
359
|
+
if (!('forEach' in targetPrototype)) {
|
|
360
|
+
Object.assign(targetPrototype, { forEach });
|
|
361
|
+
}
|
|
362
|
+
if (!('some' in targetPrototype)) {
|
|
363
|
+
Object.assign(targetPrototype, { some });
|
|
364
|
+
}
|
|
365
|
+
if (!('every' in targetPrototype)) {
|
|
366
|
+
Object.assign(targetPrototype, { every });
|
|
367
|
+
}
|
|
368
|
+
if (!('find' in targetPrototype)) {
|
|
369
|
+
Object.assign(targetPrototype, { find });
|
|
370
|
+
}
|
|
371
|
+
let IteratorConstructor = globalThis.Iterator;
|
|
372
|
+
if (!IteratorConstructor) {
|
|
373
|
+
;
|
|
374
|
+
globalThis.Iterator = {};
|
|
375
|
+
IteratorConstructor = globalThis.Iterator;
|
|
376
|
+
}
|
|
377
|
+
if (IteratorConstructor && !('from' in IteratorConstructor)) {
|
|
378
|
+
Object.assign(IteratorConstructor, { from: iteratorFrom });
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
//# sourceMappingURL=iterator-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iterator-helpers.js","sourceRoot":"","sources":["../src/iterator-helpers.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,aAAa;AACb,SAAS,oBAAoB;IAC3B,IAAI;QACF,oEAAoE;QACpE,6DAA6D;QAC7D,IAAI,OAAO,MAAM,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACvE,OAAO,IAAI,CAAA;SACZ;QACD,MAAM,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;QACvC,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;QACvD,IAAI,CAAC,cAAc;YAAE,OAAO,IAAI,CAAA;QAChC,OAAO,MAAM,CAAC,cAAc,CAAC,cAAc,CAA6B,CAAA;KACzE;IAAC,MAAM;QACN,OAAO,IAAI,CAAA;KACZ;AACH,CAAC;AAED,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,MAAM,eAAe,GAA4B,EAAE,CAAA;AAEnD,aAAa;AACb,SAAS,GAAG,CAA0B,MAAsC;IAC1E,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,IAAI,CAAA;IACrB,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAA;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,IAAI,eAAe,CAAgB,CAAA;IACjF,MAAM,CAAC,IAAI,GAAG;Q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AI,CAAC,CAAC,MAAM,IAAI,mBAAmB,CAAC,EAAE;QAC3D,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,EAAC,IAAI,EAAE,YAAY,EAAC,CAAC,CAAA;KACzD;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function groupBy<K, T>(this: MapConstructor, items: Iterable<T>, keySelector: (item: T, index: number) => K): Map<K, T[]>;
|
|
2
|
+
export declare function isSupported(): boolean;
|
|
3
|
+
export declare function isPolyfilled(): boolean;
|
|
4
|
+
export declare function apply(): void;
|
|
5
|
+
//# sourceMappingURL=map-groupby.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-groupby.d.ts","sourceRoot":"","sources":["../src/map-groupby.ts"],"names":[],"mappings":"AACA,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,GACzC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAYb;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*#__PURE__*/
|
|
2
|
+
export function groupBy(items, keySelector) {
|
|
3
|
+
const result = new Map();
|
|
4
|
+
let index = 0;
|
|
5
|
+
for (const item of items) {
|
|
6
|
+
const key = keySelector(item, index++);
|
|
7
|
+
if (result.has(key)) {
|
|
8
|
+
result.get(key).push(item);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
result.set(key, [item]);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
export function isSupported() {
|
|
18
|
+
return 'groupBy' in Map && typeof Map.groupBy === 'function';
|
|
19
|
+
}
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
export function isPolyfilled() {
|
|
22
|
+
return 'groupBy' in Map && Map.groupBy === groupBy;
|
|
23
|
+
}
|
|
24
|
+
export function apply() {
|
|
25
|
+
if (!isSupported()) {
|
|
26
|
+
Object.assign(Map, { groupBy });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=map-groupby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-groupby.js","sourceRoot":"","sources":["../src/map-groupby.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,OAAO,CAErB,KAAkB,EAClB,WAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAChC,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACnB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SAC5B;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;SACxB;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CAAA;AAC9D,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,SAAS,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAC,OAAO,EAAC,CAAC,CAAA;KAC9B;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function groupBy<K extends PropertyKey, T>(this: ObjectConstructor, items: Iterable<T>, keySelector: (item: T, index: number) => K): Partial<Record<K, T[]>>;
|
|
2
|
+
export declare function isSupported(): boolean;
|
|
3
|
+
export declare function isPolyfilled(): boolean;
|
|
4
|
+
export declare function apply(): void;
|
|
5
|
+
//# sourceMappingURL=object-groupby.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-groupby.d.ts","sourceRoot":"","sources":["../src/object-groupby.ts"],"names":[],"mappings":"AACA,wBAAgB,OAAO,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,EAC9C,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAYzB;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*#__PURE__*/
|
|
2
|
+
export function groupBy(items, keySelector) {
|
|
3
|
+
const result = Object.create(null);
|
|
4
|
+
let index = 0;
|
|
5
|
+
for (const item of items) {
|
|
6
|
+
const key = keySelector(item, index++);
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
8
|
+
result[key].push(item);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
result[key] = [item];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
/*#__PURE__*/
|
|
17
|
+
export function isSupported() {
|
|
18
|
+
return 'groupBy' in Object && typeof Object.groupBy === 'function';
|
|
19
|
+
}
|
|
20
|
+
/*#__PURE__*/
|
|
21
|
+
export function isPolyfilled() {
|
|
22
|
+
return 'groupBy' in Object && Object.groupBy === groupBy;
|
|
23
|
+
}
|
|
24
|
+
export function apply() {
|
|
25
|
+
if (!isSupported()) {
|
|
26
|
+
Object.assign(Object, { groupBy });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=object-groupby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-groupby.js","sourceRoot":"","sources":["../src/object-groupby.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,OAAO,CAErB,KAAkB,EAClB,WAA0C;IAE1C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAA4B,CAAA;IAC7D,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;YACrD,MAAM,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACxB;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;SACrB;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU,CAAA;AACpE,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,SAAS,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,OAAO,EAAC,CAAC,CAAA;KACjC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function promiseTry<T>(this: PromiseConstructor, func: () => T | PromiseLike<T>): Promise<T>;
|
|
2
|
+
export declare function isSupported(): boolean;
|
|
3
|
+
export declare function isPolyfilled(): boolean;
|
|
4
|
+
export declare function apply(): void;
|
|
5
|
+
//# sourceMappingURL=promise-try.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-try.d.ts","sourceRoot":"","sources":["../src/promise-try.ts"],"names":[],"mappings":"AACA,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAElG;AAGD,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAGD,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,IAAI,IAAI,CAI5B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*#__PURE__*/
|
|
2
|
+
export function promiseTry(func) {
|
|
3
|
+
return new Promise(resolve => resolve(func()));
|
|
4
|
+
}
|
|
5
|
+
/*#__PURE__*/
|
|
6
|
+
export function isSupported() {
|
|
7
|
+
return 'try' in Promise && typeof Promise.try === 'function';
|
|
8
|
+
}
|
|
9
|
+
/*#__PURE__*/
|
|
10
|
+
export function isPolyfilled() {
|
|
11
|
+
return 'try' in Promise && Promise.try === promiseTry;
|
|
12
|
+
}
|
|
13
|
+
export function apply() {
|
|
14
|
+
if (!isSupported()) {
|
|
15
|
+
Object.assign(Promise, { try: promiseTry });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=promise-try.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-try.js","sourceRoot":"","sources":["../src/promise-try.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,MAAM,UAAU,UAAU,CAA8B,IAA8B;IACpF,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAChD,CAAC;AAED,aAAa;AACb,MAAM,UAAU,WAAW;IACzB,OAAO,KAAK,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,CAAA;AAC9D,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAK,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,KAAK,UAAU,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,WAAW,EAAE,EAAE;QAClB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAC,GAAG,EAAE,UAAU,EAAC,CAAC,CAAA;KAC1C;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github/browser-support",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Polyfills and Capable Browser detection",
|
|
5
5
|
"homepage": "https://github.github.io/browser-support",
|
|
6
6
|
"bugs": {
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@oddbird/popover-polyfill": "^0.5.2",
|
|
50
|
-
"dialog-toggle-events-polyfill": "^1.1.3",
|
|
51
50
|
"invokers-polyfill": "^0.5.2"
|
|
51
|
+
},
|
|
52
|
+
"overrides": {
|
|
53
|
+
"koa": "2.16.3"
|
|
52
54
|
}
|
|
53
55
|
}
|