use-wizard
Version:
A dead-easy-to-use light-weight react hook to handle multi-paths wizards (and simple wizards too) and navigate into them.
22 lines (15 loc) • 439 B
text/typescript
export {isStepLastOfLasts};
/** Checks if a step is the last of the wizard */
function isStepLastOfLasts(options: any, step: string): any {
if(!options) {
return false;
}
if(typeof options[options.length - 1] === "string") {
return options[options.length - 1] === step;
}
for(let obj of Object.values(options[options.length - 1])) {
if(isStepLastOfLasts(obj, step)) {
return true;
}
}
}