feat: refactoring project
This commit is contained in:
22
node_modules/webpack/lib/container/options.js
generated
vendored
22
node_modules/webpack/lib/container/options.js
generated
vendored
@@ -5,7 +5,15 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
/** @template T @typedef {(string | Record<string, string | string[] | T>)[] | Record<string, string | string[] | T>} ContainerOptionsFormat */
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {Record<string, string | string[] | T>} Item
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {(string | Item<T>)[] | Item<T>} ContainerOptionsFormat
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template T
|
||||
@@ -17,6 +25,9 @@
|
||||
* @returns {void}
|
||||
*/
|
||||
const process = (options, normalizeSimple, normalizeOptions, fn) => {
|
||||
/**
|
||||
* @param {(string | Item<T>)[]} items items
|
||||
*/
|
||||
const array = items => {
|
||||
for (const item of items) {
|
||||
if (typeof item === "string") {
|
||||
@@ -28,6 +39,9 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => {
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {Item<T>} obj an object
|
||||
*/
|
||||
const object = obj => {
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (typeof value === "string" || Array.isArray(value)) {
|
||||
@@ -38,7 +52,7 @@ const process = (options, normalizeSimple, normalizeOptions, fn) => {
|
||||
}
|
||||
};
|
||||
if (!options) {
|
||||
return;
|
||||
// Do nothing
|
||||
} else if (Array.isArray(options)) {
|
||||
array(options);
|
||||
} else if (typeof options === "object") {
|
||||
@@ -87,5 +101,5 @@ const scope = (scope, options) => {
|
||||
return obj;
|
||||
};
|
||||
|
||||
exports.parseOptions = parseOptions;
|
||||
exports.scope = scope;
|
||||
module.exports.parseOptions = parseOptions;
|
||||
module.exports.scope = scope;
|
||||
|
||||
Reference in New Issue
Block a user