@@ -7,9 +7,7 @@ import exists from './helpers/exists';
7
7
import waitFor from './helpers/wait-for' ;
8
8
import sleep from './helpers/sleep' ;
9
9
import isRestorationVisit from './helpers/is-restoration-visit' ;
10
- import shouldFeatureRun , {
11
- ShouldRunConditions ,
12
- } from './helpers/should-feature-run' ;
10
+ import shouldFeatureRun , { ShouldRunConditions } from './helpers/should-feature-run' ;
13
11
import optionsStorage from './options-storage' ;
14
12
import { throttle } from 'lodash-es' ;
15
13
@@ -88,10 +86,7 @@ const globalReady = new Promise<object>(async (resolve) => {
88
86
resolve ( options ) ;
89
87
} ) ;
90
88
91
- const setupPageLoad = async (
92
- id : FeatureId ,
93
- config : InternalRunConfig
94
- ) : Promise < void > => {
89
+ const setupPageLoad = async ( id : FeatureId , config : InternalRunConfig ) : Promise < void > => {
95
90
const { asLongAs, include, exclude, init } = config ;
96
91
97
92
if ( ! ( await shouldFeatureRun ( { asLongAs, include, exclude } ) ) ) {
@@ -138,27 +133,14 @@ const add = async (
138
133
139
134
for ( const loader of loaders ) {
140
135
// Input defaults and validation
141
- const {
142
- asLongAs,
143
- include,
144
- exclude,
145
- init,
146
- restore,
147
- awaitDomReady = true ,
148
- } = loader ;
136
+ const { asLongAs, include, exclude, init, restore, awaitDomReady = true } = loader ;
149
137
150
138
if ( include ?. length === 0 ) {
151
- throw new Error (
152
- `${ id } : \`include\` cannot be an empty array, it means "run nowhere"`
153
- ) ;
139
+ throw new Error ( `${ id } : \`include\` cannot be an empty array, it means "run nowhere"` ) ;
154
140
}
155
141
156
142
// 404 pages should only run 404-only features
157
- if (
158
- pageDetect . is404 ( ) &&
159
- ! include ?. includes ( pageDetect . is404 ) &&
160
- ! asLongAs ?. includes ( pageDetect . is404 )
161
- ) {
143
+ if ( pageDetect . is404 ( ) && ! include ?. includes ( pageDetect . is404 ) && ! asLongAs ?. includes ( pageDetect . is404 ) ) {
162
144
continue ;
163
145
}
164
146
0 commit comments