@@ -42,43 +42,35 @@ const baseSupport =
4242 // 'at' in Array.prototype && // Polyfilled
4343 true
4444
45+ const polyfills = [
46+ abortSignalAbort ,
47+ abortSignalTimeout ,
48+ aggregateError ,
49+ arrayAt ,
50+ cryptoRandomUUID ,
51+ eventAbortSignal ,
52+ objectHasOwn ,
53+ promiseAny ,
54+ requestIdleCallback
55+ ]
56+
4557export function isSupported ( ) {
4658 return (
4759 baseSupport &&
48- abortSignalAbort . isSupported ( ) &&
49- abortSignalTimeout . isSupported ( ) &&
50- aggregateError . isSupported ( ) &&
51- arrayAt . isSupported ( ) &&
52- cryptoRandomUUID . isSupported ( ) &&
53- eventAbortSignal . isSupported ( ) &&
54- objectHasOwn . isSupported ( ) &&
55- promiseAny . isSupported ( ) &&
56- requestIdleCallback . isSupported ( )
60+ polyfills . every ( polyfill => {
61+ polyfill . isSupported ( )
62+ } )
5763 )
5864}
5965
6066export function isPolyfilled ( ) {
61- return (
62- abortSignalAbort . isPolyfilled ( ) &&
63- abortSignalTimeout . isPolyfilled ( ) &&
64- aggregateError . isPolyfilled ( ) &&
65- arrayAt . isPolyfilled ( ) &&
66- cryptoRandomUUID . isPolyfilled ( ) &&
67- eventAbortSignal . isPolyfilled ( ) &&
68- objectHasOwn . isPolyfilled ( ) &&
69- promiseAny . isPolyfilled ( ) &&
70- requestIdleCallback . isPolyfilled ( )
71- )
67+ return polyfills . every ( polyfill => {
68+ polyfill . isPolyfilled ( )
69+ } )
7270}
7371
7472export function apply ( ) {
75- abortSignalAbort . apply ( )
76- abortSignalTimeout . apply ( )
77- aggregateError . apply ( )
78- arrayAt . apply ( )
79- cryptoRandomUUID . apply ( )
80- eventAbortSignal . apply ( )
81- objectHasOwn . apply ( )
82- promiseAny . apply ( )
83- requestIdleCallback . apply ( )
73+ for ( const polyfill of polyfills ) {
74+ polyfill . apply ( )
75+ }
8476}
0 commit comments