configuring
Advanced tools
| # Configuring | ||
| ## 0.3.0 | ||
| - Add recursive partial for sub config |
@@ -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; |
+4
-1
| { | ||
| "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": "", |
+11
-3
@@ -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 @@ |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
5.01%14
7.69%314
3.29%