codeforlife 2.15.1 → 2.15.2

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.
@@ -8,6 +8,8 @@ export type OptionalPropertyNames<T> = {
8
8
  } ? K : never;
9
9
  }[keyof T];
10
10
  export type IsOptional<T, K extends keyof T> = K extends OptionalPropertyNames<T> ? true : false;
11
+ /** Creates a tuple type of length N with elements of type T. */
12
+ export type Tuple<T, N extends number, A extends T[] = []> = A["length"] extends N ? A : Tuple<T, N, [...A, T]>;
11
13
  export declare function openInNewTab(url: string, target?: string): void;
12
14
  export declare function wrap(newFn: {
13
15
  before?: (...args: any[]) => void;
@@ -1,11 +1,45 @@
1
+ /** Recursively extracts all numeric values from a nested object structure. */
2
+ export type DeepNumbersOf<T> = T extends number ? T : T extends object ? DeepNumbersOf<T[keyof T]> : never;
3
+ /** Recursively extracts all string values from a nested object structure. */
4
+ export type DeepStringsOf<T> = T extends string ? T : T extends object ? DeepStringsOf<T[keyof T]> : never;
5
+ export declare function flattenNumberValues<T extends object>(obj: T): DeepNumbersOf<T>[];
6
+ export declare function flattenStringValues<T extends object>(obj: T): DeepStringsOf<T>[];
1
7
  export declare function getNestedProperty(obj: Record<string, any>, dotPath: string | string[]): any;
2
8
  export declare function withKeyPaths(obj: object, delimiter?: string): object;
3
9
  export declare function getKeyPaths(obj: object, delimiter?: string): string[];
4
10
  export declare function excludeKeyPaths(obj: object, exclude: string[], delimiter?: string): any;
5
11
  type JoinPath<A extends string, B extends string, D extends string> = A extends "" ? B : `${A}${D}${B}`;
6
- type PrefixedValues<T extends object, Path extends string = "", D extends string = "."> = {
7
- [K in keyof T & string]: T[K] extends object ? PrefixedValues<T[K], JoinPath<Path, K, D>, D> : `${JoinPath<Path, K, D>}${D}${T[K] & (string | number | bigint | boolean | null | undefined)}`;
12
+ export type PathStringMap<T extends object, Path extends string = "", D extends string = "."> = T extends readonly (infer E extends string)[] ? {
13
+ [V in E]: JoinPath<Path, V, D>;
14
+ } : {
15
+ [K in keyof T & string]: T[K] extends readonly (infer E extends string)[] ? {
16
+ [V in E]: JoinPath<JoinPath<Path, K, D>, V, D>;
17
+ } : T[K] extends object ? PathStringMap<T[K] & object, JoinPath<Path, K, D>, D> : T[K] extends string ? {
18
+ [V in T[K]]: JoinPath<JoinPath<Path, K, D>, V, D>;
19
+ } : never;
8
20
  };
9
- export declare function prefixValuesWithKeyPath<const T extends object>(obj: T): PrefixedValues<T>;
10
- export declare function prefixValuesWithKeyPath<const T extends object, D extends string>(obj: T, delimiter: D): PrefixedValues<T, "", D>;
21
+ export declare function createPathStrings<const T extends object>(obj: T): PathStringMap<T>;
22
+ export declare function createPathStrings<const T extends object, D extends string>(obj: T, delimiter: D): PathStringMap<T, "", D>;
23
+ type PathSpec = string | {
24
+ readonly [key: string]: PathSpec;
25
+ };
26
+ type ResolvePathSpec<T, ID extends number | string> = T extends string ? Record<T, ID> : {
27
+ [K in keyof T]: ResolvePathSpec<T[K], ID>;
28
+ };
29
+ type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
30
+ export type IdRegistryResult<T extends Record<number | string, PathSpec>> = UnionToIntersection<{
31
+ [K in keyof T]: K extends number | string ? ResolvePathSpec<T[K], K> : never;
32
+ }[keyof T]>;
33
+ /**
34
+ * Converts a mapping of numeric or string keys to path specifications into a
35
+ * nested object structure where each path specification is replaced with the
36
+ * corresponding numeric or string key. This allows to create a global registry
37
+ * of unique keys that can be easily referenced in the code.
38
+ *
39
+ * @param specs A mapping of numeric or string keys to path specifications,
40
+ * where each path specification can be a string or a nested object of strings.
41
+ * @returns A nested object structure where each path specification is replaced
42
+ * with the corresponding numeric or string key.
43
+ */
44
+ export declare function createIdRegistry<T extends Record<number | string, PathSpec>>(specs: T): IdRegistryResult<T>;
11
45
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"general.cjs.js","sources":["../../src/utils/general.ts"],"sourcesContent":["export type Required<T, K extends keyof T> = { [P in K]-?: T[P] }\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>>\nexport type OptionalPropertyNames<T> = {\n [K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never\n}[keyof T]\nexport type IsOptional<T, K extends keyof T> =\n K extends OptionalPropertyNames<T> ? true : false\n\nexport function openInNewTab(url: string, target = \"_blank\"): void {\n window.open(url, target)\n}\n\nexport function wrap(\n newFn: {\n before?: (...args: any[]) => void\n after?: (...args: any[]) => void\n },\n fn?: (...args: any[]) => any,\n): (...args: any[]) => any {\n return (...args) => {\n if (newFn.before !== undefined) {\n newFn.before(...(args as unknown[]))\n }\n let value\n if (fn !== undefined) {\n value = fn(...(args as unknown[])) as unknown\n }\n if (newFn.after !== undefined) {\n newFn.after(...(args as unknown[]))\n }\n return value\n }\n}\n\nexport function snakeCaseToCamelCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([snakeKey, value]) => {\n if (typeof value === \"object\") snakeCaseToCamelCase(value as object)\n\n const camelKey = snakeKey.replace(/_+[a-z]/g, _char =>\n _char[_char.length - 1].toUpperCase(),\n )\n\n delete obj[snakeKey]\n obj[camelKey] = value as unknown\n })\n}\n\nexport function camelCaseToSnakeCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([camelKey, value]) => {\n if (typeof value === \"object\") camelCaseToSnakeCase(value as object)\n\n const snakeKey = camelKey.replace(\n /[A-Z]/g,\n char => `_${char.toLowerCase()}`,\n )\n\n delete obj[camelKey]\n obj[snakeKey] = value as unknown\n })\n}\n\nexport const MIN_DATE = new Date(0, 0, 0)\n\nexport function generateSecureRandomString(\n length: number,\n charSet: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\",\n) {\n // Create an array of 32-bit unsigned integers\n const randomValues = window.crypto.getRandomValues(new Uint8Array(length))\n\n // Map the random values to characters from our string\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += charSet.charAt(randomValues[i] % charSet.length)\n }\n\n return result\n}\n"],"names":["openInNewTab","url","target","wrap","newFn","fn","args","value","snakeCaseToCamelCase","obj","snakeKey","camelKey","_char","camelCaseToSnakeCase","char","MIN_DATE","generateSecureRandomString","length","charSet","randomValues","result","i"],"mappings":"gFAQO,SAASA,EAAaC,EAAaC,EAAS,SAAgB,CACjE,OAAO,KAAKD,EAAKC,CAAM,CACzB,CAEO,SAASC,EACdC,EAIAC,EACyB,CACzB,MAAO,IAAIC,IAAS,CACdF,EAAM,SAAW,QACnBA,EAAM,OAAO,GAAIE,CAAkB,EAErC,IAAIC,EACJ,OAAIF,IAAO,SACTE,EAAQF,EAAG,GAAIC,CAAkB,GAE/BF,EAAM,QAAU,QAClBA,EAAM,MAAM,GAAIE,CAAkB,EAE7BC,CACT,CACF,CAEO,SAASC,EAAqBC,EAAgC,CACnE,OAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACC,EAAUH,CAAK,IAAM,CAC7C,OAAOA,GAAU,UAAUC,EAAqBD,CAAe,EAEnE,MAAMI,EAAWD,EAAS,QAAQ,cAChCE,EAAMA,EAAM,OAAS,CAAC,EAAE,YAAA,CAAY,EAGtC,OAAOH,EAAIC,CAAQ,EACnBD,EAAIE,CAAQ,EAAIJ,CAClB,CAAC,CACH,CAEO,SAASM,EAAqBJ,EAAgC,CACnE,OAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACE,EAAUJ,CAAK,IAAM,CAC7C,OAAOA,GAAU,UAAUM,EAAqBN,CAAe,EAEnE,MAAMG,EAAWC,EAAS,QACxB,SACAG,GAAQ,IAAIA,EAAK,YAAA,CAAa,EAAA,EAGhC,OAAOL,EAAIE,CAAQ,EACnBF,EAAIC,CAAQ,EAAIH,CAClB,CAAC,CACH,CAEO,MAAMQ,EAAW,IAAI,KAAK,EAAG,EAAG,CAAC,EAEjC,SAASC,EACdC,EACAC,EAAkB,iEAClB,CAEA,MAAMC,EAAe,OAAO,OAAO,gBAAgB,IAAI,WAAWF,CAAM,CAAC,EAGzE,IAAIG,EAAS,GACb,QAASC,EAAI,EAAGA,EAAIJ,EAAQI,IAC1BD,GAAUF,EAAQ,OAAOC,EAAaE,CAAC,EAAIH,EAAQ,MAAM,EAG3D,OAAOE,CACT"}
1
+ {"version":3,"file":"general.cjs.js","sources":["../../src/utils/general.ts"],"sourcesContent":["export type Required<T, K extends keyof T> = { [P in K]-?: T[P] }\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>>\nexport type OptionalPropertyNames<T> = {\n [K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never\n}[keyof T]\nexport type IsOptional<T, K extends keyof T> =\n K extends OptionalPropertyNames<T> ? true : false\n\n/** Creates a tuple type of length N with elements of type T. */\nexport type Tuple<\n T,\n N extends number,\n A extends T[] = [],\n> = A[\"length\"] extends N ? A : Tuple<T, N, [...A, T]>\n\nexport function openInNewTab(url: string, target = \"_blank\"): void {\n window.open(url, target)\n}\n\nexport function wrap(\n newFn: {\n before?: (...args: any[]) => void\n after?: (...args: any[]) => void\n },\n fn?: (...args: any[]) => any,\n): (...args: any[]) => any {\n return (...args) => {\n if (newFn.before !== undefined) {\n newFn.before(...(args as unknown[]))\n }\n let value\n if (fn !== undefined) {\n value = fn(...(args as unknown[])) as unknown\n }\n if (newFn.after !== undefined) {\n newFn.after(...(args as unknown[]))\n }\n return value\n }\n}\n\nexport function snakeCaseToCamelCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([snakeKey, value]) => {\n if (typeof value === \"object\") snakeCaseToCamelCase(value as object)\n\n const camelKey = snakeKey.replace(/_+[a-z]/g, _char =>\n _char[_char.length - 1].toUpperCase(),\n )\n\n delete obj[snakeKey]\n obj[camelKey] = value as unknown\n })\n}\n\nexport function camelCaseToSnakeCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([camelKey, value]) => {\n if (typeof value === \"object\") camelCaseToSnakeCase(value as object)\n\n const snakeKey = camelKey.replace(\n /[A-Z]/g,\n char => `_${char.toLowerCase()}`,\n )\n\n delete obj[camelKey]\n obj[snakeKey] = value as unknown\n })\n}\n\nexport const MIN_DATE = new Date(0, 0, 0)\n\nexport function generateSecureRandomString(\n length: number,\n charSet: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\",\n) {\n // Create an array of 32-bit unsigned integers\n const randomValues = window.crypto.getRandomValues(new Uint8Array(length))\n\n // Map the random values to characters from our string\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += charSet.charAt(randomValues[i] % charSet.length)\n }\n\n return result\n}\n"],"names":["openInNewTab","url","target","wrap","newFn","fn","args","value","snakeCaseToCamelCase","obj","snakeKey","camelKey","_char","camelCaseToSnakeCase","char","MIN_DATE","generateSecureRandomString","length","charSet","randomValues","result","i"],"mappings":"gFAeO,SAASA,EAAaC,EAAaC,EAAS,SAAgB,CACjE,OAAO,KAAKD,EAAKC,CAAM,CACzB,CAEO,SAASC,EACdC,EAIAC,EACyB,CACzB,MAAO,IAAIC,IAAS,CACdF,EAAM,SAAW,QACnBA,EAAM,OAAO,GAAIE,CAAkB,EAErC,IAAIC,EACJ,OAAIF,IAAO,SACTE,EAAQF,EAAG,GAAIC,CAAkB,GAE/BF,EAAM,QAAU,QAClBA,EAAM,MAAM,GAAIE,CAAkB,EAE7BC,CACT,CACF,CAEO,SAASC,EAAqBC,EAAgC,CACnE,OAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACC,EAAUH,CAAK,IAAM,CAC7C,OAAOA,GAAU,UAAUC,EAAqBD,CAAe,EAEnE,MAAMI,EAAWD,EAAS,QAAQ,cAChCE,EAAMA,EAAM,OAAS,CAAC,EAAE,YAAA,CAAY,EAGtC,OAAOH,EAAIC,CAAQ,EACnBD,EAAIE,CAAQ,EAAIJ,CAClB,CAAC,CACH,CAEO,SAASM,EAAqBJ,EAAgC,CACnE,OAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACE,EAAUJ,CAAK,IAAM,CAC7C,OAAOA,GAAU,UAAUM,EAAqBN,CAAe,EAEnE,MAAMG,EAAWC,EAAS,QACxB,SACAG,GAAQ,IAAIA,EAAK,YAAA,CAAa,EAAA,EAGhC,OAAOL,EAAIE,CAAQ,EACnBF,EAAIC,CAAQ,EAAIH,CAClB,CAAC,CACH,CAEO,MAAMQ,EAAW,IAAI,KAAK,EAAG,EAAG,CAAC,EAEjC,SAASC,EACdC,EACAC,EAAkB,iEAClB,CAEA,MAAMC,EAAe,OAAO,OAAO,gBAAgB,IAAI,WAAWF,CAAM,CAAC,EAGzE,IAAIG,EAAS,GACb,QAASC,EAAI,EAAGA,EAAIJ,EAAQI,IAC1BD,GAAUF,EAAQ,OAAOC,EAAaE,CAAC,EAAIH,EAAQ,MAAM,EAG3D,OAAOE,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"general.es.js","sources":["../../src/utils/general.ts"],"sourcesContent":["export type Required<T, K extends keyof T> = { [P in K]-?: T[P] }\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>>\nexport type OptionalPropertyNames<T> = {\n [K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never\n}[keyof T]\nexport type IsOptional<T, K extends keyof T> =\n K extends OptionalPropertyNames<T> ? true : false\n\nexport function openInNewTab(url: string, target = \"_blank\"): void {\n window.open(url, target)\n}\n\nexport function wrap(\n newFn: {\n before?: (...args: any[]) => void\n after?: (...args: any[]) => void\n },\n fn?: (...args: any[]) => any,\n): (...args: any[]) => any {\n return (...args) => {\n if (newFn.before !== undefined) {\n newFn.before(...(args as unknown[]))\n }\n let value\n if (fn !== undefined) {\n value = fn(...(args as unknown[])) as unknown\n }\n if (newFn.after !== undefined) {\n newFn.after(...(args as unknown[]))\n }\n return value\n }\n}\n\nexport function snakeCaseToCamelCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([snakeKey, value]) => {\n if (typeof value === \"object\") snakeCaseToCamelCase(value as object)\n\n const camelKey = snakeKey.replace(/_+[a-z]/g, _char =>\n _char[_char.length - 1].toUpperCase(),\n )\n\n delete obj[snakeKey]\n obj[camelKey] = value as unknown\n })\n}\n\nexport function camelCaseToSnakeCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([camelKey, value]) => {\n if (typeof value === \"object\") camelCaseToSnakeCase(value as object)\n\n const snakeKey = camelKey.replace(\n /[A-Z]/g,\n char => `_${char.toLowerCase()}`,\n )\n\n delete obj[camelKey]\n obj[snakeKey] = value as unknown\n })\n}\n\nexport const MIN_DATE = new Date(0, 0, 0)\n\nexport function generateSecureRandomString(\n length: number,\n charSet: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\",\n) {\n // Create an array of 32-bit unsigned integers\n const randomValues = window.crypto.getRandomValues(new Uint8Array(length))\n\n // Map the random values to characters from our string\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += charSet.charAt(randomValues[i] % charSet.length)\n }\n\n return result\n}\n"],"names":["openInNewTab","url","target","wrap","newFn","fn","args","value","snakeCaseToCamelCase","obj","snakeKey","camelKey","_char","camelCaseToSnakeCase","char","MIN_DATE","generateSecureRandomString","length","charSet","randomValues","result","i"],"mappings":"AAQO,SAASA,EAAaC,GAAaC,IAAS,UAAgB;AACjE,SAAO,KAAKD,GAAKC,CAAM;AACzB;AAEO,SAASC,EACdC,GAIAC,GACyB;AACzB,SAAO,IAAIC,MAAS;AAClB,IAAIF,EAAM,WAAW,UACnBA,EAAM,OAAO,GAAIE,CAAkB;AAErC,QAAIC;AACJ,WAAIF,MAAO,WACTE,IAAQF,EAAG,GAAIC,CAAkB,IAE/BF,EAAM,UAAU,UAClBA,EAAM,MAAM,GAAIE,CAAkB,GAE7BC;AAAA,EACT;AACF;AAEO,SAASC,EAAqBC,GAAgC;AACnE,SAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACC,GAAUH,CAAK,MAAM;AACjD,IAAI,OAAOA,KAAU,YAAUC,EAAqBD,CAAe;AAEnE,UAAMI,IAAWD,EAAS;AAAA,MAAQ;AAAA,MAAY,OAC5CE,EAAMA,EAAM,SAAS,CAAC,EAAE,YAAA;AAAA,IAAY;AAGtC,WAAOH,EAAIC,CAAQ,GACnBD,EAAIE,CAAQ,IAAIJ;AAAA,EAClB,CAAC;AACH;AAEO,SAASM,EAAqBJ,GAAgC;AACnE,SAAO,QAAQA,CAAG,EAAE,QAAQ,CAAC,CAACE,GAAUJ,CAAK,MAAM;AACjD,IAAI,OAAOA,KAAU,YAAUM,EAAqBN,CAAe;AAEnE,UAAMG,IAAWC,EAAS;AAAA,MACxB;AAAA,MACA,CAAAG,MAAQ,IAAIA,EAAK,YAAA,CAAa;AAAA,IAAA;AAGhC,WAAOL,EAAIE,CAAQ,GACnBF,EAAIC,CAAQ,IAAIH;AAAA,EAClB,CAAC;AACH;AAEO,MAAMQ,IAAW,IAAI,KAAK,GAAG,GAAG,CAAC;AAEjC,SAASC,EACdC,GACAC,IAAkB,kEAClB;AAEA,QAAMC,IAAe,OAAO,OAAO,gBAAgB,IAAI,WAAWF,CAAM,CAAC;AAGzE,MAAIG,IAAS;AACb,WAASC,IAAI,GAAGA,IAAIJ,GAAQI;AAC1B,IAAAD,KAAUF,EAAQ,OAAOC,EAAaE,CAAC,IAAIH,EAAQ,MAAM;AAG3D,SAAOE;AACT;"}
1
+ {"version":3,"file":"general.es.js","sources":["../../src/utils/general.ts"],"sourcesContent":["export type Required<T, K extends keyof T> = { [P in K]-?: T[P] }\nexport type Optional<T, K extends keyof T> = Partial<Pick<T, K>>\nexport type OptionalPropertyNames<T> = {\n [K in keyof T]-?: {} extends { [P in K]: T[K] } ? K : never\n}[keyof T]\nexport type IsOptional<T, K extends keyof T> =\n K extends OptionalPropertyNames<T> ? true : false\n\n/** Creates a tuple type of length N with elements of type T. */\nexport type Tuple<\n T,\n N extends number,\n A extends T[] = [],\n> = A[\"length\"] extends N ? A : Tuple<T, N, [...A, T]>\n\nexport function openInNewTab(url: string, target = \"_blank\"): void {\n window.open(url, target)\n}\n\nexport function wrap(\n newFn: {\n before?: (...args: any[]) => void\n after?: (...args: any[]) => void\n },\n fn?: (...args: any[]) => any,\n): (...args: any[]) => any {\n return (...args) => {\n if (newFn.before !== undefined) {\n newFn.before(...(args as unknown[]))\n }\n let value\n if (fn !== undefined) {\n value = fn(...(args as unknown[])) as unknown\n }\n if (newFn.after !== undefined) {\n newFn.after(...(args as unknown[]))\n }\n return value\n }\n}\n\nexport function snakeCaseToCamelCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([snakeKey, value]) => {\n if (typeof value === \"object\") snakeCaseToCamelCase(value as object)\n\n const camelKey = snakeKey.replace(/_+[a-z]/g, _char =>\n _char[_char.length - 1].toUpperCase(),\n )\n\n delete obj[snakeKey]\n obj[camelKey] = value as unknown\n })\n}\n\nexport function camelCaseToSnakeCase(obj: Record<string, any>): void {\n Object.entries(obj).forEach(([camelKey, value]) => {\n if (typeof value === \"object\") camelCaseToSnakeCase(value as object)\n\n const snakeKey = camelKey.replace(\n /[A-Z]/g,\n char => `_${char.toLowerCase()}`,\n )\n\n delete obj[camelKey]\n obj[snakeKey] = value as unknown\n })\n}\n\nexport const MIN_DATE = new Date(0, 0, 0)\n\nexport function generateSecureRandomString(\n length: number,\n charSet: string = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\",\n) {\n // Create an array of 32-bit unsigned integers\n const randomValues = window.crypto.getRandomValues(new Uint8Array(length))\n\n // Map the random values to characters from our string\n let result = \"\"\n for (let i = 0; i < length; i++) {\n result += charSet.charAt(randomValues[i] % charSet.length)\n }\n\n return result\n}\n"],"names":["openInNewTab","url","target","wrap","newFn","fn","args","value","snakeCaseToCamelCase","obj","snakeKey","camelKey","_char","camelCaseToSnakeCase","char","MIN_DATE","generateSecureRandomString","length","charSet","randomValues","result","i"],"mappings":"AAeO,SAASA,EAAaC,GAAaC,IAAS,UAAgB;AACjE,SAAO,KAAKD,GAAKC,CAAM;AACzB;AAEO,SAASC,EACdC,GAIAC,GACyB;AACzB,SAAO,IAAIC,MAAS;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ag,{value:"Module"});function h(o,e){typeof e=="string"&&(e=e.split("."));let n=o;for(let i=0;i<e.length;i++)if(n=n[e[i]],i!==e.length-1&&(typeof n!="object"||n===null))return;return n}function p(o,e="."){function n(i,c){return Object.fromEntries(Object.entries(i).map(([s,t])=>{const r=[...c,s];return typeof t=="object"&&t!==null&&(t=n(t,r)),[r.join(e),t]}))}return n(o,[])}function u(o,e="."){function n(i,c){return Object.entries(i).map(([s,t])=>{const r=[...c,s],f=r.join(e);return typeof t=="object"&&t!==null?[f,...n(t,r)]:[f]}).flat()}return n(o,[])}function y(o,e,n="."){function i(c,s){return Object.fromEntries(Object.entries(c).map(([t,r])=>{const f=[...s,t];return typeof r=="object"&&r!==null&&!(r instanceof Date)&&(r=i(r,f)),e.includes(f.join(n))?[]:[t,r]}).filter(t=>t.length))}return e.length?i(o,[]):o}function j(o,e="."){function n(i,c){return Object.fromEntries(Object.entries(i).map(([s,t])=>{const r=[...c,s];return typeof t=="object"&&t!==null?t=n(t,r):t=`${r.join(e)}${e}${t}`,[s,t]}))}return n(o,[])}exports.excludeKeyPaths=y;exports.getKeyPaths=u;exports.getNestedProperty=h;exports.prefixValuesWithKeyPath=j;exports.withKeyPaths=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function u(i,e){return Object.values(i).flatMap(n=>e(n)?[n]:typeof n=="object"&&n!==null?u(n,e):[])}function y(i){return u(i,e=>typeof e=="number")}function l(i){return u(i,e=>typeof e=="string")}function p(i,e){typeof e=="string"&&(e=e.split("."));let n=i;for(let r=0;r<e.length;r++)if(n=n[e[r]],r!==e.length-1&&(typeof n!="object"||n===null))return;return n}function a(i,e="."){function n(r,o){return Object.fromEntries(Object.entries(r).map(([s,t])=>{const f=[...o,s];return typeof t=="object"&&t!==null&&(t=n(t,f)),[f.join(e),t]}))}return n(i,[])}function b(i,e="."){function n(r,o){return Object.entries(r).map(([s,t])=>{const f=[...o,s],c=f.join(e);return typeof t=="object"&&t!==null?[c,...n(t,f)]:[c]}).flat()}return n(i,[])}function g(i,e,n="."){function r(o,s){return Object.fromEntries(Object.entries(o).map(([t,f])=>{const c=[...s,t];return typeof f=="object"&&f!==null&&!(f instanceof Date)&&(f=r(f,c)),e.includes(c.join(n))?[]:[t,f]}).filter(t=>t.length))}return e.length?r(i,[]):i}function j(i,e="."){function n(r,o){return Array.isArray(r)?Object.fromEntries(r.map(s=>[s,[...o,s].join(e)])):Object.fromEntries(Object.entries(r).map(([s,t])=>{const f=[...o,s];return typeof t=="object"&&t!==null?t=n(t,f):typeof t=="string"&&(t={[t]:[...f,t].join(e)}),[s,t]}))}return n(i,[])}function h(i){const e={};function n(r,o,s){if(typeof o=="string")r[o]=s;else for(const[t,f]of Object.entries(o))t in r||(r[t]={}),n(r[t],f,s)}for(const[r,o]of Object.entries(i)){const s=Number(r),t=!isNaN(s)&&r.trim()!==""?s:r;n(e,o,t)}return e}exports.createIdRegistry=h;exports.createPathStrings=j;exports.excludeKeyPaths=g;exports.flattenNumberValues=y;exports.flattenStringValues=l;exports.getKeyPaths=b;exports.getNestedProperty=p;exports.withKeyPaths=a;
2
2
  //# sourceMappingURL=object.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.cjs.js","sources":["../../src/utils/object.ts"],"sourcesContent":["export function getNestedProperty(\n obj: Record<string, any>,\n dotPath: string | string[],\n): any {\n if (typeof dotPath === \"string\") dotPath = dotPath.split(\".\")\n\n let value: unknown = obj\n for (let i = 0; i < dotPath.length; i++) {\n value = (value as Record<string, any>)[dotPath[i]]\n if (\n i !== dotPath.length - 1 &&\n (typeof value !== \"object\" || value === null)\n )\n return\n }\n\n return value\n}\n\nexport function withKeyPaths(obj: object, delimiter: string = \".\"): object {\n function _withKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _withKeyPaths(value as object, _path)\n\n return [_path.join(delimiter), value]\n }),\n )\n }\n\n return _withKeyPaths(obj, [])\n}\n\nexport function getKeyPaths(obj: object, delimiter: string = \".\"): string[] {\n function _getKeyPaths(obj: object, path: string[]): string[] {\n return Object.entries(obj)\n .map(([key, value]) => {\n const _path = [...path, key]\n const keyPath = _path.join(delimiter)\n\n return typeof value === \"object\" && value !== null\n ? [keyPath, ..._getKeyPaths(value as object, _path)]\n : [keyPath]\n })\n .flat()\n }\n\n return _getKeyPaths(obj, [])\n}\n\nexport function excludeKeyPaths(\n obj: object,\n exclude: string[],\n delimiter: string = \".\",\n): any {\n function _excludeKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]: [string, unknown]) => {\n const _path = [...path, key]\n\n if (\n typeof value === \"object\" &&\n value !== null &&\n !(value instanceof Date)\n )\n value = _excludeKeyPaths(value, _path)\n\n return exclude.includes(_path.join(delimiter)) ? [] : [key, value]\n })\n .filter(entry => entry.length),\n ) as object\n }\n\n return exclude.length ? _excludeKeyPaths(obj, []) : obj\n}\n\ntype JoinPath<\n A extends string,\n B extends string,\n D extends string,\n> = A extends \"\" ? B : `${A}${D}${B}`\n\ntype PrefixedValues<\n T extends object,\n Path extends string = \"\",\n D extends string = \".\",\n> = {\n [K in keyof T & string]: T[K] extends object\n ? PrefixedValues<T[K], JoinPath<Path, K, D>, D>\n : `${JoinPath<Path, K, D>}${D}${T[K] & (string | number | bigint | boolean | null | undefined)}`\n}\n\nexport function prefixValuesWithKeyPath<const T extends object>(\n obj: T,\n): PrefixedValues<T>\nexport function prefixValuesWithKeyPath<\n const T extends object,\n D extends string,\n>(obj: T, delimiter: D): PrefixedValues<T, \"\", D>\nexport function prefixValuesWithKeyPath(\n obj: object,\n delimiter: string = \".\",\n): object {\n function _prefixValuesWithKeyPath(obj: object, path: string[]): object {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _prefixValuesWithKeyPath(value as object, _path)\n else value = `${_path.join(delimiter)}${delimiter}${value}`\n\n return [key, value]\n }),\n )\n }\n\n return _prefixValuesWithKeyPath(obj, [])\n}\n"],"names":["getNestedProperty","obj","dotPath","value","withKeyPaths","delimiter","_withKeyPaths","path","key","_path","getKeyPaths","_getKeyPaths","keyPath","excludeKeyPaths","exclude","_excludeKeyPaths","entry","prefixValuesWithKeyPath","_prefixValuesWithKeyPath"],"mappings":"gFAAO,SAASA,EACdC,EACAC,EACK,CACD,OAAOA,GAAY,WAAUA,EAAUA,EAAQ,MAAM,GAAG,GAE5D,IAAIC,EAAiBF,EACrB,QAAS,EAAI,EAAG,EAAIC,EAAQ,OAAQ,IAElC,GADAC,EAASA,EAA8BD,EAAQ,CAAC,CAAC,EAE/C,IAAMA,EAAQ,OAAS,IACtB,OAAOC,GAAU,UAAYA,IAAU,MAExC,OAGJ,OAAOA,CACT,CAEO,SAASC,EAAaH,EAAaI,EAAoB,IAAa,CACzE,SAASC,EAAcL,EAAaM,EAAgB,CAClD,OAAO,OAAO,YACZ,OAAO,QAAQN,CAAG,EAAE,IAAI,CAAC,CAACO,EAAKL,CAAK,IAAM,CACxC,MAAMM,EAAQ,CAAC,GAAGF,EAAMC,CAAG,EAE3B,OAAI,OAAOL,GAAU,UAAYA,IAAU,OACzCA,EAAQG,EAAcH,EAAiBM,CAAK,GAEvC,CAACA,EAAM,KAAKJ,CAAS,EAAGF,CAAK,CACtC,CAAC,CAAA,CAEL,CAEA,OAAOG,EAAcL,EAAK,EAAE,CAC9B,CAEO,SAASS,EAAYT,EAAaI,EAAoB,IAAe,CAC1E,SAASM,EAAaV,EAAaM,EAA0B,CAC3D,OAAO,OAAO,QAAQN,CAAG,EACtB,IAAI,CAAC,CAACO,EAAKL,CAAK,IAAM,CACrB,MAAMM,EAAQ,CAAC,GAAGF,EAAMC,CAAG,EACrBI,EAAUH,EAAM,KAAKJ,CAAS,EAEpC,OAAO,OAAOF,GAAU,UAAYA,IAAU,KAC1C,CAACS,EAAS,GAAGD,EAAaR,EAAiBM,CAAK,CAAC,EACjD,CAACG,CAAO,CACd,CAAC,EACA,KAAA,CACL,CAEA,OAAOD,EAAaV,EAAK,EAAE,CAC7B,CAEO,SAASY,EACdZ,EACAa,EACAT,EAAoB,IACf,CACL,SAASU,EAAiBd,EAAaM,EAAgB,CACrD,OAAO,OAAO,YACZ,OAAO,QAAQN,CAAG,EACf,IAAI,CAAC,CAACO,EAAKL,CAAK,IAAyB,CACxC,MAAMM,EAAQ,CAAC,GAAGF,EAAMC,CAAG,EAE3B,OACE,OAAOL,GAAU,UACjBA,IAAU,MACV,EAAEA,aAAiB,QAEnBA,EAAQY,EAAiBZ,EAAOM,CAAK,GAEhCK,EAAQ,SAASL,EAAM,KAAKJ,CAAS,CAAC,EAAI,CAAA,EAAK,CAACG,EAAKL,CAAK,CACnE,CAAC,EACA,OAAOa,GAASA,EAAM,MAAM,CAAA,CAEnC,CAEA,OAAOF,EAAQ,OAASC,EAAiBd,EAAK,CAAA,CAAE,EAAIA,CACtD,CAyBO,SAASgB,EACdhB,EACAI,EAAoB,IACZ,CACR,SAASa,EAAyBjB,EAAaM,EAAwB,CACrE,OAAO,OAAO,YACZ,OAAO,QAAQN,CAAG,EAAE,IAAI,CAAC,CAACO,EAAKL,CAAK,IAAM,CACxC,MAAMM,EAAQ,CAAC,GAAGF,EAAMC,CAAG,EAE3B,OAAI,OAAOL,GAAU,UAAYA,IAAU,KACzCA,EAAQe,EAAyBf,EAAiBM,CAAK,EACpDN,EAAQ,GAAGM,EAAM,KAAKJ,CAAS,CAAC,GAAGA,CAAS,GAAGF,CAAK,GAElD,CAACK,EAAKL,CAAK,CACpB,CAAC,CAAA,CAEL,CAEA,OAAOe,EAAyBjB,EAAK,EAAE,CACzC"}
1
+ {"version":3,"file":"object.cjs.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/** Recursively extracts all numeric values from a nested object structure. */\nexport type DeepNumbersOf<T> = T extends number\n ? T\n : T extends object\n ? DeepNumbersOf<T[keyof T]>\n : never\n/** Recursively extracts all string values from a nested object structure. */\nexport type DeepStringsOf<T> = T extends string\n ? T\n : T extends object\n ? DeepStringsOf<T[keyof T]>\n : never\n\nfunction _flattenValuesOfType<T extends object, U>(\n obj: T,\n typeGuard: (value: unknown) => value is U,\n): U[] {\n return Object.values(obj).flatMap(v =>\n typeGuard(v)\n ? [v]\n : typeof v === \"object\" && v !== null\n ? _flattenValuesOfType(v, typeGuard)\n : [],\n )\n}\n\nexport function flattenNumberValues<T extends object>(\n obj: T,\n): DeepNumbersOf<T>[] {\n return _flattenValuesOfType(\n obj,\n (value): value is number => typeof value === \"number\",\n ) as DeepNumbersOf<T>[]\n}\n\nexport function flattenStringValues<T extends object>(\n obj: T,\n): DeepStringsOf<T>[] {\n return _flattenValuesOfType(\n obj,\n (value): value is string => typeof value === \"string\",\n ) as DeepStringsOf<T>[]\n}\n\nexport function getNestedProperty(\n obj: Record<string, any>,\n dotPath: string | string[],\n): any {\n if (typeof dotPath === \"string\") dotPath = dotPath.split(\".\")\n\n let value: unknown = obj\n for (let i = 0; i < dotPath.length; i++) {\n value = (value as Record<string, any>)[dotPath[i]]\n if (\n i !== dotPath.length - 1 &&\n (typeof value !== \"object\" || value === null)\n )\n return\n }\n\n return value\n}\n\nexport function withKeyPaths(obj: object, delimiter: string = \".\"): object {\n function _withKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _withKeyPaths(value as object, _path)\n\n return [_path.join(delimiter), value]\n }),\n )\n }\n\n return _withKeyPaths(obj, [])\n}\n\nexport function getKeyPaths(obj: object, delimiter: string = \".\"): string[] {\n function _getKeyPaths(obj: object, path: string[]): string[] {\n return Object.entries(obj)\n .map(([key, value]) => {\n const _path = [...path, key]\n const keyPath = _path.join(delimiter)\n\n return typeof value === \"object\" && value !== null\n ? [keyPath, ..._getKeyPaths(value as object, _path)]\n : [keyPath]\n })\n .flat()\n }\n\n return _getKeyPaths(obj, [])\n}\n\nexport function excludeKeyPaths(\n obj: object,\n exclude: string[],\n delimiter: string = \".\",\n): any {\n function _excludeKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]: [string, unknown]) => {\n const _path = [...path, key]\n\n if (\n typeof value === \"object\" &&\n value !== null &&\n !(value instanceof Date)\n )\n value = _excludeKeyPaths(value, _path)\n\n return exclude.includes(_path.join(delimiter)) ? [] : [key, value]\n })\n .filter(entry => entry.length),\n ) as object\n }\n\n return exclude.length ? _excludeKeyPaths(obj, []) : obj\n}\n\ntype JoinPath<\n A extends string,\n B extends string,\n D extends string,\n> = A extends \"\" ? B : `${A}${D}${B}`\n\nexport type PathStringMap<\n T extends object,\n Path extends string = \"\",\n D extends string = \".\",\n> = T extends readonly (infer E extends string)[]\n ? { [V in E]: JoinPath<Path, V, D> }\n : {\n [K in keyof T & string]: T[K] extends readonly (infer E extends string)[]\n ? { [V in E]: JoinPath<JoinPath<Path, K, D>, V, D> }\n : T[K] extends object\n ? PathStringMap<T[K] & object, JoinPath<Path, K, D>, D>\n : T[K] extends string\n ? { [V in T[K]]: JoinPath<JoinPath<Path, K, D>, V, D> }\n : never\n }\n\nexport function createPathStrings<const T extends object>(\n obj: T,\n): PathStringMap<T>\nexport function createPathStrings<const T extends object, D extends string>(\n obj: T,\n delimiter: D,\n): PathStringMap<T, \"\", D>\nexport function createPathStrings(\n obj: object,\n delimiter: string = \".\",\n): object {\n function _createPathStrings(obj: object, path: string[]): object {\n if (Array.isArray(obj)) {\n return Object.fromEntries(\n (obj as string[]).map(value => [\n value,\n [...path, value].join(delimiter),\n ]),\n )\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _createPathStrings(value as object, _path)\n else if (typeof value === \"string\")\n value = { [value]: [..._path, value].join(delimiter) }\n\n return [key, value]\n }),\n )\n }\n\n return _createPathStrings(obj, [])\n}\n\ntype PathSpec = string | { readonly [key: string]: PathSpec }\n\ntype ResolvePathSpec<T, ID extends number | string> = T extends string\n ? Record<T, ID>\n : { [K in keyof T]: ResolvePathSpec<T[K], ID> }\n\ntype UnionToIntersection<U> = (\n U extends unknown ? (x: U) => void : never\n) extends (x: infer I) => void\n ? I\n : never\n\nexport type IdRegistryResult<T extends Record<number | string, PathSpec>> =\n UnionToIntersection<\n {\n [K in keyof T]: K extends number | string\n ? ResolvePathSpec<T[K], K>\n : never\n }[keyof T]\n >\n\n/**\n * Converts a mapping of numeric or string keys to path specifications into a\n * nested object structure where each path specification is replaced with the\n * corresponding numeric or string key. This allows to create a global registry\n * of unique keys that can be easily referenced in the code.\n *\n * @param specs A mapping of numeric or string keys to path specifications,\n * where each path specification can be a string or a nested object of strings.\n * @returns A nested object structure where each path specification is replaced\n * with the corresponding numeric or string key.\n */\nexport function createIdRegistry<T extends Record<number | string, PathSpec>>(\n specs: T,\n): IdRegistryResult<T> {\n const result: Record<string, unknown> = {}\n\n function _assignPath(\n target: Record<string, unknown>,\n pathSpec: PathSpec,\n id: number | string,\n ): void {\n if (typeof pathSpec === \"string\") {\n target[pathSpec] = id\n } else {\n for (const [key, nested] of Object.entries(pathSpec)) {\n if (!(key in target)) target[key] = {}\n _assignPath(target[key] as Record<string, unknown>, nested, id)\n }\n }\n }\n\n for (const [idStr, pathSpec] of Object.entries(specs)) {\n const num = Number(idStr)\n const id: number | string = !isNaN(num) && idStr.trim() !== \"\" ? num : idStr\n _assignPath(result, pathSpec, id)\n }\n\n return result as IdRegistryResult<T>\n}\n"],"names":["_flattenValuesOfType","obj","typeGuard","v","flattenNumberValues","value","flattenStringValues","getNestedProperty","dotPath","i","withKeyPaths","delimiter","_withKeyPaths","path","key","_path","getKeyPaths","_getKeyPaths","keyPath","excludeKeyPaths","exclude","_excludeKeyPaths","entry","createPathStrings","_createPathStrings","createIdRegistry","specs","result","_assignPath","target","pathSpec","id","nested","idStr","num"],"mappings":"gFAaA,SAASA,EACPC,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K,EAAE,KAAKM,CAAS,CAAA,GAE9C,CAACG,EAAKT,CAAK,CACpB,CAAC,CAAA,CAEL,CAEA,OAAOmB,EAAmBvB,EAAK,EAAE,CACnC,CAkCO,SAASwB,EACdC,EACqB,CACrB,MAAMC,EAAkC,CAAA,EAExC,SAASC,EACPC,EACAC,EACAC,EACM,CACN,GAAI,OAAOD,GAAa,SACtBD,EAAOC,CAAQ,EAAIC,MAEnB,UAAW,CAACjB,EAAKkB,CAAM,IAAK,OAAO,QAAQF,CAAQ,EAC3ChB,KAAOe,IAASA,EAAOf,CAAG,EAAI,CAAA,GACpCc,EAAYC,EAAOf,CAAG,EAA8BkB,EAAQD,CAAE,CAGpE,CAEA,SAAW,CAACE,EAAOH,CAAQ,IAAK,OAAO,QAAQJ,CAAK,EAAG,CACrD,MAAMQ,EAAM,OAAOD,CAAK,EAClBF,EAAsB,CAAC,MAAMG,CAAG,GAAKD,EAAM,KAAA,IAAW,GAAKC,EAAMD,EACvEL,EAAYD,EAAQG,EAAUC,CAAE,CAClC,CAEA,OAAOJ,CACT"}
@@ -1,58 +1,98 @@
1
- function p(o, n) {
1
+ function u(i, n) {
2
+ return Object.values(i).flatMap(
3
+ (e) => n(e) ? [e] : typeof e == "object" && e !== null ? u(e, n) : []
4
+ );
5
+ }
6
+ function p(i) {
7
+ return u(
8
+ i,
9
+ (n) => typeof n == "number"
10
+ );
11
+ }
12
+ function y(i) {
13
+ return u(
14
+ i,
15
+ (n) => typeof n == "string"
16
+ );
17
+ }
18
+ function j(i, n) {
2
19
  typeof n == "string" && (n = n.split("."));
3
- let e = o;
4
- for (let i = 0; i < n.length; i++)
5
- if (e = e[n[i]], i !== n.length - 1 && (typeof e != "object" || e === null))
20
+ let e = i;
21
+ for (let r = 0; r < n.length; r++)
22
+ if (e = e[n[r]], r !== n.length - 1 && (typeof e != "object" || e === null))
6
23
  return;
7
24
  return e;
8
25
  }
9
- function h(o, n = ".") {
10
- function e(i, f) {
26
+ function b(i, n = ".") {
27
+ function e(r, s) {
11
28
  return Object.fromEntries(
12
- Object.entries(i).map(([c, t]) => {
13
- const r = [...f, c];
14
- return typeof t == "object" && t !== null && (t = e(t, r)), [r.join(n), t];
29
+ Object.entries(r).map(([f, t]) => {
30
+ const o = [...s, f];
31
+ return typeof t == "object" && t !== null && (t = e(t, o)), [o.join(n), t];
15
32
  })
16
33
  );
17
34
  }
18
- return e(o, []);
35
+ return e(i, []);
19
36
  }
20
- function u(o, n = ".") {
21
- function e(i, f) {
22
- return Object.entries(i).map(([c, t]) => {
23
- const r = [...f, c], s = r.join(n);
24
- return typeof t == "object" && t !== null ? [s, ...e(t, r)] : [s];
37
+ function l(i, n = ".") {
38
+ function e(r, s) {
39
+ return Object.entries(r).map(([f, t]) => {
40
+ const o = [...s, f], c = o.join(n);
41
+ return typeof t == "object" && t !== null ? [c, ...e(t, o)] : [c];
25
42
  }).flat();
26
43
  }
27
- return e(o, []);
44
+ return e(i, []);
28
45
  }
29
- function j(o, n, e = ".") {
30
- function i(f, c) {
46
+ function g(i, n, e = ".") {
47
+ function r(s, f) {
31
48
  return Object.fromEntries(
32
- Object.entries(f).map(([t, r]) => {
33
- const s = [...c, t];
34
- return typeof r == "object" && r !== null && !(r instanceof Date) && (r = i(r, s)), n.includes(s.join(e)) ? [] : [t, r];
49
+ Object.entries(s).map(([t, o]) => {
50
+ const c = [...f, t];
51
+ return typeof o == "object" && o !== null && !(o instanceof Date) && (o = r(o, c)), n.includes(c.join(e)) ? [] : [t, o];
35
52
  }).filter((t) => t.length)
36
53
  );
37
54
  }
38
- return n.length ? i(o, []) : o;
55
+ return n.length ? r(i, []) : i;
39
56
  }
40
- function y(o, n = ".") {
41
- function e(i, f) {
42
- return Object.fromEntries(
43
- Object.entries(i).map(([c, t]) => {
44
- const r = [...f, c];
45
- return typeof t == "object" && t !== null ? t = e(t, r) : t = `${r.join(n)}${n}${t}`, [c, t];
57
+ function h(i, n = ".") {
58
+ function e(r, s) {
59
+ return Array.isArray(r) ? Object.fromEntries(
60
+ r.map((f) => [
61
+ f,
62
+ [...s, f].join(n)
63
+ ])
64
+ ) : Object.fromEntries(
65
+ Object.entries(r).map(([f, t]) => {
66
+ const o = [...s, f];
67
+ return typeof t == "object" && t !== null ? t = e(t, o) : typeof t == "string" && (t = { [t]: [...o, t].join(n) }), [f, t];
46
68
  })
47
69
  );
48
70
  }
49
- return e(o, []);
71
+ return e(i, []);
72
+ }
73
+ function m(i) {
74
+ const n = {};
75
+ function e(r, s, f) {
76
+ if (typeof s == "string")
77
+ r[s] = f;
78
+ else
79
+ for (const [t, o] of Object.entries(s))
80
+ t in r || (r[t] = {}), e(r[t], o, f);
81
+ }
82
+ for (const [r, s] of Object.entries(i)) {
83
+ const f = Number(r), t = !isNaN(f) && r.trim() !== "" ? f : r;
84
+ e(n, s, t);
85
+ }
86
+ return n;
50
87
  }
51
88
  export {
52
- j as excludeKeyPaths,
53
- u as getKeyPaths,
54
- p as getNestedProperty,
55
- y as prefixValuesWithKeyPath,
56
- h as withKeyPaths
89
+ m as createIdRegistry,
90
+ h as createPathStrings,
91
+ g as excludeKeyPaths,
92
+ p as flattenNumberValues,
93
+ y as flattenStringValues,
94
+ l as getKeyPaths,
95
+ j as getNestedProperty,
96
+ b as withKeyPaths
57
97
  };
58
98
  //# sourceMappingURL=object.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.es.js","sources":["../../src/utils/object.ts"],"sourcesContent":["export function getNestedProperty(\n obj: Record<string, any>,\n dotPath: string | string[],\n): any {\n if (typeof dotPath === \"string\") dotPath = dotPath.split(\".\")\n\n let value: unknown = obj\n for (let i = 0; i < dotPath.length; i++) {\n value = (value as Record<string, any>)[dotPath[i]]\n if (\n i !== dotPath.length - 1 &&\n (typeof value !== \"object\" || value === null)\n )\n return\n }\n\n return value\n}\n\nexport function withKeyPaths(obj: object, delimiter: string = \".\"): object {\n function _withKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _withKeyPaths(value as object, _path)\n\n return [_path.join(delimiter), value]\n }),\n )\n }\n\n return _withKeyPaths(obj, [])\n}\n\nexport function getKeyPaths(obj: object, delimiter: string = \".\"): string[] {\n function _getKeyPaths(obj: object, path: string[]): string[] {\n return Object.entries(obj)\n .map(([key, value]) => {\n const _path = [...path, key]\n const keyPath = _path.join(delimiter)\n\n return typeof value === \"object\" && value !== null\n ? [keyPath, ..._getKeyPaths(value as object, _path)]\n : [keyPath]\n })\n .flat()\n }\n\n return _getKeyPaths(obj, [])\n}\n\nexport function excludeKeyPaths(\n obj: object,\n exclude: string[],\n delimiter: string = \".\",\n): any {\n function _excludeKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]: [string, unknown]) => {\n const _path = [...path, key]\n\n if (\n typeof value === \"object\" &&\n value !== null &&\n !(value instanceof Date)\n )\n value = _excludeKeyPaths(value, _path)\n\n return exclude.includes(_path.join(delimiter)) ? [] : [key, value]\n })\n .filter(entry => entry.length),\n ) as object\n }\n\n return exclude.length ? _excludeKeyPaths(obj, []) : obj\n}\n\ntype JoinPath<\n A extends string,\n B extends string,\n D extends string,\n> = A extends \"\" ? B : `${A}${D}${B}`\n\ntype PrefixedValues<\n T extends object,\n Path extends string = \"\",\n D extends string = \".\",\n> = {\n [K in keyof T & string]: T[K] extends object\n ? PrefixedValues<T[K], JoinPath<Path, K, D>, D>\n : `${JoinPath<Path, K, D>}${D}${T[K] & (string | number | bigint | boolean | null | undefined)}`\n}\n\nexport function prefixValuesWithKeyPath<const T extends object>(\n obj: T,\n): PrefixedValues<T>\nexport function prefixValuesWithKeyPath<\n const T extends object,\n D extends string,\n>(obj: T, delimiter: D): PrefixedValues<T, \"\", D>\nexport function prefixValuesWithKeyPath(\n obj: object,\n delimiter: string = \".\",\n): object {\n function _prefixValuesWithKeyPath(obj: object, path: string[]): object {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _prefixValuesWithKeyPath(value as object, _path)\n else value = `${_path.join(delimiter)}${delimiter}${value}`\n\n return [key, value]\n }),\n )\n }\n\n return _prefixValuesWithKeyPath(obj, [])\n}\n"],"names":["getNestedProperty","obj","dotPath","value","withKeyPaths","delimiter","_withKeyPaths","path","key","_path","getKeyPaths","_getKeyPaths","keyPath","excludeKeyPaths","exclude","_excludeKeyPaths","entry","prefixValuesWithKeyPath","_prefixValuesWithKeyPath"],"mappings":"AAAO,SAASA,EACdC,GACAC,GACK;AACL,EAAI,OAAOA,KAAY,aAAUA,IAAUA,EAAQ,MAAM,GAAG;AAE5D,MAAIC,IAAiBF;AACrB,WAAS,IAAI,GAAG,IAAIC,EAAQ,QAAQ;AAElC,QADAC,IAASA,EAA8BD,EAAQ,CAAC,CAAC,GAE/C,MAAMA,EAAQ,SAAS,MACtB,OAAOC,KAAU,YAAYA,MAAU;AAExC;AAGJ,SAAOA;AACT;AAEO,SAASC,EAAaH,GAAaI,IAAoB,KAAa;AACzE,WAASC,EAAcL,GAAaM,GAAgB;AAClD,WAAO,OAAO;AAAA,MACZ,OAAO,QAAQN,CAAG,EAAE,IAAI,CAAC,CAACO,GAAKL,CAAK,MAAM;AACxC,cAAMM,IAAQ,CAAC,GAAGF,GAAMC,CAAG;AAE3B,eAAI,OAAOL,KAAU,YAAYA,MAAU,SACzCA,IAAQG,EAAcH,GAAiBM,CAAK,IAEvC,CAACA,EAAM,KAAKJ,CAAS,GAAGF,CAAK;AAAA,MACtC,CAAC;AAAA,IAAA;AAAA,EAEL;AAEA,SAAOG,EAAcL,GAAK,EAAE;AAC9B;AAEO,SAASS,EAAYT,GAAaI,IAAoB,KAAe;AAC1E,WAASM,EAAaV,GAAaM,GAA0B;AAC3D,WAAO,OAAO,QAAQN,CAAG,EACtB,IAAI,CAAC,CAACO,GAAKL,CAAK,MAAM;AACrB,YAAMM,IAAQ,CAAC,GAAGF,GAAMC,CA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AK,EAAE;AACzC;"}
1
+ {"version":3,"file":"object.es.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/** Recursively extracts all numeric values from a nested object structure. */\nexport type DeepNumbersOf<T> = T extends number\n ? T\n : T extends object\n ? DeepNumbersOf<T[keyof T]>\n : never\n/** Recursively extracts all string values from a nested object structure. */\nexport type DeepStringsOf<T> = T extends string\n ? T\n : T extends object\n ? DeepStringsOf<T[keyof T]>\n : never\n\nfunction _flattenValuesOfType<T extends object, U>(\n obj: T,\n typeGuard: (value: unknown) => value is U,\n): U[] {\n return Object.values(obj).flatMap(v =>\n typeGuard(v)\n ? [v]\n : typeof v === \"object\" && v !== null\n ? _flattenValuesOfType(v, typeGuard)\n : [],\n )\n}\n\nexport function flattenNumberValues<T extends object>(\n obj: T,\n): DeepNumbersOf<T>[] {\n return _flattenValuesOfType(\n obj,\n (value): value is number => typeof value === \"number\",\n ) as DeepNumbersOf<T>[]\n}\n\nexport function flattenStringValues<T extends object>(\n obj: T,\n): DeepStringsOf<T>[] {\n return _flattenValuesOfType(\n obj,\n (value): value is string => typeof value === \"string\",\n ) as DeepStringsOf<T>[]\n}\n\nexport function getNestedProperty(\n obj: Record<string, any>,\n dotPath: string | string[],\n): any {\n if (typeof dotPath === \"string\") dotPath = dotPath.split(\".\")\n\n let value: unknown = obj\n for (let i = 0; i < dotPath.length; i++) {\n value = (value as Record<string, any>)[dotPath[i]]\n if (\n i !== dotPath.length - 1 &&\n (typeof value !== \"object\" || value === null)\n )\n return\n }\n\n return value\n}\n\nexport function withKeyPaths(obj: object, delimiter: string = \".\"): object {\n function _withKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _withKeyPaths(value as object, _path)\n\n return [_path.join(delimiter), value]\n }),\n )\n }\n\n return _withKeyPaths(obj, [])\n}\n\nexport function getKeyPaths(obj: object, delimiter: string = \".\"): string[] {\n function _getKeyPaths(obj: object, path: string[]): string[] {\n return Object.entries(obj)\n .map(([key, value]) => {\n const _path = [...path, key]\n const keyPath = _path.join(delimiter)\n\n return typeof value === \"object\" && value !== null\n ? [keyPath, ..._getKeyPaths(value as object, _path)]\n : [keyPath]\n })\n .flat()\n }\n\n return _getKeyPaths(obj, [])\n}\n\nexport function excludeKeyPaths(\n obj: object,\n exclude: string[],\n delimiter: string = \".\",\n): any {\n function _excludeKeyPaths(obj: object, path: string[]) {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]: [string, unknown]) => {\n const _path = [...path, key]\n\n if (\n typeof value === \"object\" &&\n value !== null &&\n !(value instanceof Date)\n )\n value = _excludeKeyPaths(value, _path)\n\n return exclude.includes(_path.join(delimiter)) ? [] : [key, value]\n })\n .filter(entry => entry.length),\n ) as object\n }\n\n return exclude.length ? _excludeKeyPaths(obj, []) : obj\n}\n\ntype JoinPath<\n A extends string,\n B extends string,\n D extends string,\n> = A extends \"\" ? B : `${A}${D}${B}`\n\nexport type PathStringMap<\n T extends object,\n Path extends string = \"\",\n D extends string = \".\",\n> = T extends readonly (infer E extends string)[]\n ? { [V in E]: JoinPath<Path, V, D> }\n : {\n [K in keyof T & string]: T[K] extends readonly (infer E extends string)[]\n ? { [V in E]: JoinPath<JoinPath<Path, K, D>, V, D> }\n : T[K] extends object\n ? PathStringMap<T[K] & object, JoinPath<Path, K, D>, D>\n : T[K] extends string\n ? { [V in T[K]]: JoinPath<JoinPath<Path, K, D>, V, D> }\n : never\n }\n\nexport function createPathStrings<const T extends object>(\n obj: T,\n): PathStringMap<T>\nexport function createPathStrings<const T extends object, D extends string>(\n obj: T,\n delimiter: D,\n): PathStringMap<T, \"\", D>\nexport function createPathStrings(\n obj: object,\n delimiter: string = \".\",\n): object {\n function _createPathStrings(obj: object, path: string[]): object {\n if (Array.isArray(obj)) {\n return Object.fromEntries(\n (obj as string[]).map(value => [\n value,\n [...path, value].join(delimiter),\n ]),\n )\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => {\n const _path = [...path, key]\n\n if (typeof value === \"object\" && value !== null)\n value = _createPathStrings(value as object, _path)\n else if (typeof value === \"string\")\n value = { [value]: [..._path, value].join(delimiter) }\n\n return [key, value]\n }),\n )\n }\n\n return _createPathStrings(obj, [])\n}\n\ntype PathSpec = string | { readonly [key: string]: PathSpec }\n\ntype ResolvePathSpec<T, ID extends number | string> = T extends string\n ? Record<T, ID>\n : { [K in keyof T]: ResolvePathSpec<T[K], ID> }\n\ntype UnionToIntersection<U> = (\n U extends unknown ? (x: U) => void : never\n) extends (x: infer I) => void\n ? I\n : never\n\nexport type IdRegistryResult<T extends Record<number | string, PathSpec>> =\n UnionToIntersection<\n {\n [K in keyof T]: K extends number | string\n ? ResolvePathSpec<T[K], K>\n : never\n }[keyof T]\n >\n\n/**\n * Converts a mapping of numeric or string keys to path specifications into a\n * nested object structure where each path specification is replaced with the\n * corresponding numeric or string key. This allows to create a global registry\n * of unique keys that can be easily referenced in the code.\n *\n * @param specs A mapping of numeric or string keys to path specifications,\n * where each path specification can be a string or a nested object of strings.\n * @returns A nested object structure where each path specification is replaced\n * with the corresponding numeric or string key.\n */\nexport function createIdRegistry<T extends Record<number | string, PathSpec>>(\n specs: T,\n): IdRegistryResult<T> {\n const result: Record<string, unknown> = {}\n\n function _assignPath(\n target: Record<string, unknown>,\n pathSpec: PathSpec,\n id: number | string,\n ): void {\n if (typeof pathSpec === \"string\") {\n target[pathSpec] = id\n } else {\n for (const [key, nested] of Object.entries(pathSpec)) {\n if (!(key in target)) target[key] = {}\n _assignPath(target[key] as Record<string, unknown>, nested, id)\n }\n }\n }\n\n for (const [idStr, pathSpec] of Object.entries(specs)) {\n const num = Number(idStr)\n const id: number | string = !isNaN(num) && idStr.trim() !== \"\" ? num : idStr\n _assignPath(result, pathSpec, id)\n }\n\n return result as IdRegistryResult<T>\n}\n"],"names":["_flattenValuesOfType","obj","typeGuard","v","flattenNumberValues","value","flattenStringValues","getNestedProperty","dotPath","i","withKeyPaths","delimiter","_withKeyPaths","path","key","_path","getKeyPaths","_getKeyPaths","keyPath","excludeKeyPaths","exclude","_excludeKeyPaths","entry","createPathStrings","_createPathStrings","createIdRegistry","specs","result","_assignPath","target","pathSpec","id","nested","idStr","num"],"mappings":"AAaA,SAASA,EACPC,GACAC,GACK;AACL,SAAO,OAAO,OAAOD,CAAG,EAAE;AAAA,IAAQ,OAChCC,EAAUC,CAAC,IACP,CAACA,CAAC,IACF,OAAOA,KAAM,YAAYA,MAAM,OAC7BH,EAAqBG,GAAGD,CAAS,IACjC,CAAA;AAAA,EAAC;AAEX;AAEO,SAASE,EACdH,GACoB;AACpB,SAAOD;AAAA,IACLC;AAAA,IACA,CAACI,MAA2B,OAAOA,KAAU;AAAA,EAAA;AAEjD;AAEO,SAASC,EACdL,GACoB;AACpB,SAAOD;AAAA,IACLC;AAAA,IACA,CAACI,MAA2B,OAAOA,KAAU;AAAA,EAAA;AAEjD;AAEO,SAASE,EACdN,GACAO,GACK;AACL,EAAI,OAAOA,KAAY,aAAUA,IAAUA,EAAQ,MAAM,GAAG;AAE5D,MAAIH,IAAiBJ;AACrB,WAASQ,IAAI,GAAGA,IAAID,EAAQ,QAAQC;AAElC,QADAJ,IAASA,EAA8BG,EAAQC,CAAC,CAAC,GAE/CA,MAAMD,EAAQ,SAAS,MACtB,OAAOH,KAAU,YAAYA,MAAU;AAExC;AAGJ,SAAOA;AACT;AAEO,SAASK,EAAaT,GAAaU,IAAoB,KAAa;AACzE,WAASC,EAAcX,GAAaY,GAAgB;AAClD,WAAO,OAAO;AAAA,MACZ,OAAO,QAAQZ,CAAG,EAAE,IAAI,CAAC,CAACa,GAAKT,CAAK,MAAM;AACxC,cAAMU,IAAQ,CAAC,GAAGF,GAAMC,CAAG;AAE3B,eAAI,OAAOT,KAAU,YAAYA,MAAU,SACzCA,IAAQO,EAAcP,GAAiBU,CAAK,IAEvC,CAACA,EAAM,KAAKJ,CAAS,GAAGN,CAAK;AAAA,MACtC,CAAC;AAA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Q,GAAMR,CAAK,EAAE,KAAKM,CAAS;AAAA,MAAA,CAChC;AAAA,IAAA,IAIE,OAAO;AAAA,MACZ,OAAO,QAAQV,CAAG,EAAE,IAAI,CAAC,CAACa,GAAKT,CAAK,MAAM;AACxC,cAAMU,IAAQ,CAAC,GAAGF,GAAMC,CAAG;AAE3B,eAAI,OAAOT,KAAU,YAAYA,MAAU,OACzCA,IAAQmB,EAAmBnB,GAAiBU,CAAK,IAC1C,OAAOV,KAAU,aACxBA,IAAQ,EAAE,CAACA,CAAK,GAAG,CAAC,GAAGU,GAAOV,CAAK,EAAE,KAAKM,CAAS,EAAA,IAE9C,CAACG,GAAKT,CAAK;AAAA,MACpB,CAAC;AAAA,IAAA;AAAA,EAEL;AAEA,SAAOmB,EAAmBvB,GAAK,EAAE;AACnC;AAkCO,SAASwB,EACdC,GACqB;AACrB,QAAMC,IAAkC,CAAA;AAExC,WAASC,EACPC,GACAC,GACAC,GACM;AACN,QAAI,OAAOD,KAAa;AACtB,MAAAD,EAAOC,CAAQ,IAAIC;AAAA;AAEnB,iBAAW,CAACjB,GAAKkB,CAAM,KAAK,OAAO,QAAQF,CAAQ;AACjD,QAAMhB,KAAOe,MAASA,EAAOf,CAAG,IAAI,CAAA,IACpCc,EAAYC,EAAOf,CAAG,GAA8BkB,GAAQD,CAAE;AAAA,EAGpE;AAEA,aAAW,CAACE,GAAOH,CAAQ,KAAK,OAAO,QAAQJ,CAAK,GAAG;AACrD,UAAMQ,IAAM,OAAOD,CAAK,GAClBF,IAAsB,CAAC,MAAMG,CAAG,KAAKD,EAAM,KAAA,MAAW,KAAKC,IAAMD;AACvE,IAAAL,EAAYD,GAAQG,GAAUC,CAAE;AAAA,EAClC;AAEA,SAAOJ;AACT;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "codeforlife",
3
3
  "description": "Common frontend code",
4
4
  "private": false,
5
- "version": "2.15.1",
5
+ "version": "2.15.2",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
8
  "module": "dist/index.es.js",