(obj, prop, factory)
| 266 | * @returns {void} |
| 267 | */ |
| 268 | const A = (obj, prop, factory) => { |
| 269 | const value = obj[prop]; |
| 270 | if (value === undefined) { |
| 271 | obj[prop] = factory(); |
| 272 | } else if (Array.isArray(value)) { |
| 273 | /** @type {EXPECTED_ANY[] | undefined} */ |
| 274 | let newArray; |
| 275 | for (let i = 0; i < value.length; i++) { |
| 276 | const item = value[i]; |
| 277 | if (item === "...") { |
| 278 | if (newArray === undefined) { |
| 279 | newArray = value.slice(0, i); |
| 280 | obj[prop] = /** @type {T[P]} */ (/** @type {unknown} */ (newArray)); |
| 281 | } |
| 282 | const items = |
| 283 | /** @type {EXPECTED_ANY[]} */ |
| 284 | (/** @type {unknown} */ (factory())); |
| 285 | if (items !== undefined) { |
| 286 | for (const item of items) { |
| 287 | newArray.push(item); |
| 288 | } |
| 289 | } |
| 290 | } else if (newArray !== undefined) { |
| 291 | newArray.push(item); |
| 292 | } |
| 293 | } |
| 294 | } |
| 295 | }; |
| 296 | |
| 297 | /** |
| 298 | * Apply webpack options base defaults. |
no test coverage detected