@@ -42,46 +42,36 @@ 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+ elementReplaceChildren ,
52+ eventAbortSignal ,
53+ objectHasOwn ,
54+ promiseAny ,
55+ requestIdleCallback
56+ ]
57+
4558export function isSupported ( ) {
4659 return (
4760 baseSupport &&
48- abortSignalAbort . isSupported ( ) &&
49- abortSignalTimeout . isSupported ( ) &&
50- aggregateError . isSupported ( ) &&
51- arrayAt . isSupported ( ) &&
52- cryptoRandomUUID . isSupported ( ) &&
53- elementReplaceChildren . isSupported ( ) &&
54- eventAbortSignal . isSupported ( ) &&
55- objectHasOwn . isSupported ( ) &&
56- promiseAny . isSupported ( ) &&
57- requestIdleCallback . isSupported ( )
61+ polyfills . every ( polyfill => {
62+ polyfill . isSupported ( )
63+ } )
5864 )
5965}
6066
6167export function isPolyfilled ( ) {
62- return (
63- abortSignalAbort . isPolyfilled ( ) &&
64- abortSignalTimeout . isPolyfilled ( ) &&
65- aggregateError . isPolyfilled ( ) &&
66- arrayAt . isPolyfilled ( ) &&
67- cryptoRandomUUID . isPolyfilled ( ) &&
68- elementReplaceChildren . isPolyfilled ( ) &&
69- eventAbortSignal . isPolyfilled ( ) &&
70- objectHasOwn . isPolyfilled ( ) &&
71- promiseAny . isPolyfilled ( ) &&
72- requestIdleCallback . isPolyfilled ( )
73- )
68+ return polyfills . every ( polyfill => {
69+ polyfill . isPolyfilled ( )
70+ } )
7471}
7572
7673export function apply ( ) {
77- abortSignalAbort . apply ( )
78- abortSignalTimeout . apply ( )
79- aggregateError . apply ( )
80- arrayAt . apply ( )
81- cryptoRandomUUID . apply ( )
82- elementReplaceChildren . apply ( )
83- eventAbortSignal . apply ( )
84- objectHasOwn . apply ( )
85- promiseAny . apply ( )
86- requestIdleCallback . apply ( )
74+ for ( const polyfill of polyfills ) {
75+ polyfill . apply ( )
76+ }
8777}
0 commit comments