configate 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/common.d.ts CHANGED
@@ -1,6 +1,21 @@
1
1
  export type DefaultConfig = Record<string, any>;
2
+ /**
3
+ * Environment type represents all allowed application environments
4
+ * string is also allowed to support custom environments
5
+ */
2
6
  export type Environment = 'development' | 'staging' | 'production' | 'test' | string;
7
+ /**
8
+ * FileExtension type represents all allowed file extensions of config files
9
+ */
3
10
  export type FileExtension = 'ts' | 'mts' | 'js' | 'mjs' | 'cjs' | 'json';
11
+ /**
12
+ * DeepPartial allows to make all properties of an object optional recursively
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * type PartialConfig = DeepPartial<YourConfigStructure>
17
+ * ```
18
+ */
4
19
  export type DeepPartial<T> = T extends object ? {
5
20
  [P in keyof T]?: DeepPartial<T[P]>;
6
21
  } : T | undefined;
@@ -21,8 +21,9 @@ export function makeSecureDeepProxy(config) {
21
21
  function makeSecureProxy(targetObject) {
22
22
  return new Proxy(targetObject, {
23
23
  get(target, prop) {
24
- // Handle Symbol.toStringTag and Array properties
25
- if (prop === Symbol.toStringTag ||
24
+ // Handle Symbol and Array properties
25
+ if (typeof prop === 'symbol' ||
26
+ // Don't throw error when using array methods
26
27
  (Array.isArray(target) && Number.isNaN(Number(prop)))) {
27
28
  return Reflect.get(target, prop);
28
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "configate",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "Configuration helper for TypeScript applications",
6
6
  "main": "dist/index.js",