objectenvy
Merging
| Function | Description |
|---|---|
| merge | Recursively merge two configuration objects, with obj2 winning on conflicts. |
| override | Apply default values to a config object, filling in only the keys that are absent in config. |
Parsing
| Name | Description |
|---|---|
| defaultNonNestingPrefixes | Prefix segments that are never treated as nesting roots regardless of how many env vars share them. |
| coerceValue | Coerce a raw environment variable string to its most appropriate JavaScript type. |
| objectEnvy | Create a memoized configuration loader with preset options, returning bound objectify and envy helpers. |
| objectify | Parse process.env (or a custom env object) into a strongly-typed, nested, camelCased config object. |
| safeObjectify | Non-throwing variant of objectify. Returns a discriminated union instead of throwing on validation failure or transform errors. |
| toCamelCase | Convert a SCREAMING_SNAKE_CASE string to camelCase. |
Serialization
| Function | Description |
|---|---|
| envy | Serialize a nested camelCased config object back to a flat SCREAMING_SNAKE_CASE env record. |
| toSnakeCase | Convert a camelCase or PascalCase string to SCREAMING_SNAKE_CASE. |
Type Utilities
| Name | Description |
|---|---|
| MergeOptions | Options for controlling the merge behaviour of merge() and override(). |
| ObjectEnvyOptions | Configuration options for objectify() — controls prefix filtering, env source, Zod schema validation, camelCase nesting behaviour, and include/exclude patterns. |
| ArrayMergeStrategy | Strategy for merging arrays when combining configuration objects via merge() or override(). |
| ConfigObject | Nested configuration object with string keys and recursively nested values. Exported as ConfigObject — represents a parsed environment config tree. |
| ConfigValue | A single configuration value — either a primitive string/number/boolean, an array of primitives/objects, or a nested ConfigObject. Exported as ConfigValue. |
| FromEnv | Convert a flat SCREAMING_SNAKE_CASE env record type to a nested camelCase config type. |
| SchemaToEnv | Extract the flat SCREAMING_SNAKE_CASE env record type from a Zod schema or a plain config type. |
| ToEnv | Convert a nested camelCase config type to a flat SCREAMING_SNAKE_CASE env record, preserving string literal and template literal types. |
| WithoutPrefix | Remove a Prefix_ from all keys in an env record type, keeping only the matching keys. |
| WithPrefix | Add a Prefix_ to all keys in an env record type. |