core-utils
    Preparing search index...
    • Validates comma-separated string or array inputs and normalizes them to typed arrays.

      Accepts:

      • Comma-separated strings (split and validated per item)
      • Arrays of items (validated per item)

      Designed for shared contracts where the server receives comma-separated query strings and the client passes typed arrays.

      Composable with .optional(), .nullable(), etc. at the call site:

      z.object({
      workerTypes: commaSeparatedArray(z.string().min(1)).optional(),
      dates: commaSeparatedArray(dateTimeSchema()).optional(),
      });

      z.input → string | T[] (where T is z.input of the item schema) z.output → T[] (where T is z.output of the item schema)

      Type Parameters

      • T extends ZodTypeAny

      Parameters

      • itemSchema: T

      Returns ZodPipeline<
          ZodUnion<[ZodEffects<ZodString, string[], string>, ZodArray<T, "many">]>,
          ZodArray<T, "many">,
      >