diff --git a/src/features/feature.ts b/src/features/feature.ts index 2946726..65c03bb 100644 --- a/src/features/feature.ts +++ b/src/features/feature.ts @@ -60,13 +60,37 @@ export function setDefault( } } -export function findFeatures(obj: Record, type: symbol): unknown[] { +export function findFeatures(obj: Record, ...types: symbol[]): unknown[] { const objects: unknown[] = []; const handleObject = (obj: Record) => { Object.keys(obj).forEach(key => { const value = obj[key]; if (value && typeof value === "object") { - if ((value as Record).type === type) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (types.includes((value as Record).type)) { + objects.push(value); + } else if (!(value instanceof Decimal) && !isRef(value)) { + handleObject(value as Record); + } + } + }); + }; + handleObject(obj); + return objects; +} + +export function excludeFeatures(obj: Record, ...types: symbol[]): unknown[] { + const objects: unknown[] = []; + const handleObject = (obj: Record) => { + Object.keys(obj).forEach(key => { + const value = obj[key]; + if (value && typeof value === "object") { + if ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + typeof (value as Record).type == "symbol" && + // eslint-disable-next-line @typescript-eslint/no-explicit-any + !types.includes((value as Record).type) + ) { objects.push(value); } else if (!(value instanceof Decimal) && !isRef(value)) { handleObject(value as Record);