18 lines
448 B
TypeScript
18 lines
448 B
TypeScript
import type { AskParams } from "../types.ts";
|
|
import { normalizeQuestions } from "./normalize.ts";
|
|
import { createInitialState as createBaseState } from "./transitions.ts";
|
|
|
|
interface CreateInitialStateOptions {
|
|
allowFreeform?: boolean;
|
|
}
|
|
|
|
export function createInitialState(
|
|
params: AskParams,
|
|
options: CreateInitialStateOptions = {}
|
|
) {
|
|
return createBaseState({
|
|
title: params.title,
|
|
questions: normalizeQuestions(params, options),
|
|
});
|
|
}
|