# DynamicFactory Source: https://partfactory.dev/factories/dynamic-factory/ Index of every page: https://partfactory.dev/llms.txt Creates complete items from a function that builds default values. Use this factory when defaults should be generated fresh for each item, such as when values need to be unique, random, or based on the requested overrides. The default maker receives the same overrides passed to `make`, then the overrides are applied to the generated defaults. The default maker can also declare dependencies, which are passed to `make` after the overrides. ## Usage ```typescript interface User { id: string; name: string; active: boolean; } const userFactory = new DynamicFactory(() => ({ id: crypto.randomUUID(), name: "Test User", active: true, })); const defaultUser = userFactory.make(); // { id: "...", name: "Test User", active: true } const inactiveUser = userFactory.make({ active: false }); // { id: "...", name: "Test User", active: false } ``` ## Source Source file: [`src/dynamic/dynamic-factory.ts`](https://github.com/KensioSoftware/part-factory/blob/main/src/dynamic/dynamic-factory.ts)