MCPcopy
hub / github.com/angular/angular / normalizeFormArgs

Function normalizeFormArgs

packages/forms/signals/src/util/normalize_form_args.ts:18–42  ·  view source on GitHub ↗
(
  args: any[],
)

Source from the content-addressed store, hash-verified

16 * Extracts the model, schema, and options from the arguments passed to `form()`.
17 */
18export function normalizeFormArgs<TModel>(
19 args: any[],
20): [
21 WritableSignal<TModel>,
22 SchemaOrSchemaFn<TModel> | undefined,
23 (FormOptions<TModel> & {adapter?: FieldAdapter}) | undefined,
24] {
25 let model: WritableSignal<TModel>;
26 let schema: SchemaOrSchemaFn<TModel> | undefined;
27 let options: (FormOptions<TModel> & {adapter?: FieldAdapter}) | undefined;
28
29 if (args.length === 3) {
30 [model, schema, options] = args;
31 } else if (args.length === 2) {
32 if (isSchemaOrSchemaFn(args[1])) {
33 [model, schema] = args;
34 } else {
35 [model, options] = args;
36 }
37 } else {
38 [model] = args;
39 }
40
41 return [model, schema, options];
42}

Callers 3

constructorMethod · 0.90
compatFormFunction · 0.90
formFunction · 0.90

Calls 1

isSchemaOrSchemaFnFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…