configuring
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -0,12 +1,15 @@ | ||
export declare type RecursivePartial<T> = { | ||
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P]; | ||
}; | ||
export interface ConfigManagerOptions<TConfig> { | ||
configurations: { | ||
default: TConfig; | ||
[env: string]: Partial<TConfig>; | ||
[env: string]: RecursivePartial<TConfig>; | ||
}; | ||
} | ||
export interface ConfigurationManager<TConfig> { | ||
get: (key: string, env?: string) => any; | ||
getConfig: (env?: string) => TConfig; | ||
get: (key: keyof TConfig, env?: string) => any; | ||
getConfig: (env?: string) => Readonly<TConfig>; | ||
} | ||
export declare const createConfigManager: <TConfig>(options: ConfigManagerOptions<TConfig>) => ConfigurationManager<TConfig>; | ||
export default createConfigManager; |
{ | ||
"name": "configuring", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A configuration system for typescript projects", | ||
@@ -16,2 +16,5 @@ "main": "dist/index.cjs.js", | ||
}, | ||
"repository": { | ||
"url": "https://github.com/ramiel/configuring" | ||
}, | ||
"keywords": [], | ||
@@ -18,0 +21,0 @@ "author": "", |
@@ -5,6 +5,14 @@ import defaultsDeep from 'lodash/defaultsDeep'; | ||
export type RecursivePartial<T> = { | ||
[P in keyof T]?: T[P] extends (infer U)[] | ||
? RecursivePartial<U>[] | ||
: T[P] extends object | ||
? RecursivePartial<T[P]> | ||
: T[P]; | ||
}; | ||
export interface ConfigManagerOptions<TConfig> { | ||
configurations: { | ||
default: TConfig; | ||
[env: string]: Partial<TConfig>; | ||
[env: string]: RecursivePartial<TConfig>; | ||
}; | ||
@@ -14,4 +22,4 @@ } | ||
export interface ConfigurationManager<TConfig> { | ||
get: (key: string, env?: string) => any; | ||
getConfig: (env?: string) => TConfig; | ||
get: (key: keyof TConfig, env?: string) => any; | ||
getConfig: (env?: string) => Readonly<TConfig>; | ||
} | ||
@@ -18,0 +26,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
11428
14
314