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.
17 lines (10 loc) • 507 B
text/typescript
import {TWizardType} from "../../types/TWizardType";
import {isTypeLinearS} from "../../types/typeGuards/isTypeLinearS";
import {isTypeNested} from "../../types/typeGuards/isTypeNested";
export {getWizardType};
const getWizardType = (args: { options: unknown }): TWizardType => {
if(!args.options) return 'linearN';
if(isTypeLinearS(args.options)) return 'linearS';
if(isTypeNested(args.options)) return 'nested';
throw new Error("Wizard error: wrong wizard type, open an issue");
}