Skip to main content
Version: 1.1.0

resolveSet

Using

Function that retrieves or resolves only Set values. This function should handle various input types, resolving functions if encountered, and ultimately return an Set if possible.

If the final resolved value is not an Set or if a function remains unresolved within the specified depth, the function return undefined.

Arguments

ArgumentTypeDescriptionExample
valueSet
function
Value for resolve.new Set()
() => () => new Set(["value1", "value2"])
depthnumberDepth of maximum resolve.2

Returns

Set | undefined — Returns the resolved Set otherwise undefined.

Examples

resolveSet(new Set());
// Set {}

resolveSet(() => () => new Set(['value1', 'value2']));
// Set { "value1", "value2" }

resolveSet('text');
// undefined

resolveSet(() => new Set(['name', 0]), 1);
// Set { "name", 0 }

resolveSet(() => new Set(['name', 0]), 2);
// Set { "name", 0 }

resolveSet(() => new Set(['name', 0]), 0);
// undefined

Resources

📦 Since:1.1.0
📦 Last updated:1.1.0
📦 Available in:1.3.0