@bemedev/decompose 0.5.0 → 0.7.0

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/lib/decompose.cjs CHANGED
@@ -2,29 +2,34 @@
2
2
 
3
3
  var constants_strings = require('./constants/strings.cjs');
4
4
  var helpers = require('./helpers.cjs');
5
- var sortMap = require('./sortMap.cjs');
6
5
 
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
7
  function ddecompose(val, prev = '') {
9
8
  const _prev = prev ? prev + constants_strings.DELIMITER : '';
10
9
  const output = [];
11
10
  const entries1 = Object.entries(val);
12
11
  entries1.forEach(([key, value]) => {
13
- output.push(`${_prev}${key}`);
14
12
  const isPrimit = helpers.isPrimitive(value);
15
13
  if (!isPrimit) {
16
14
  const values = ddecompose(value, `${_prev}${key}`);
17
15
  output.push(...values);
18
16
  }
17
+ else
18
+ output.push([`${_prev}${key}`, value]);
19
19
  });
20
20
  return output;
21
21
  }
22
- function decompose(val, sorter) {
23
- const output1 = ddecompose(val, '');
24
- output1.sort(sorter ?? sortMap.sortMap);
22
+ function decompose(val) {
23
+ const entries1 = ddecompose(val, '');
24
+ if (entries1.length == 0)
25
+ return {};
25
26
  const regex = new RegExp(constants_strings.DELIMITER, 'g');
26
- const output2 = output1.map(value => value.replace(regex, '.'));
27
- return output2;
27
+ const entries2 = entries1.map(([key, value]) => [
28
+ key.replace(regex, '.'),
29
+ value,
30
+ ]);
31
+ const output = Object.fromEntries(entries2);
32
+ return output;
28
33
  }
29
34
 
30
35
  exports.decompose = decompose;
@@ -1 +1 @@
1
- {"version":3,"file":"decompose.cjs","sources":["../src/decompose.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport { Ru } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction ddecompose(val: any, prev = '') {\n const _prev = prev ? prev + DELIMITER : '';\n const output: string[] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n output.push(`${_prev}${key}`);\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n const values = ddecompose(value, `${_prev}${key}`);\n output.push(...values);\n }\n });\n return output;\n}\n\nexport function decompose<T extends Ru>(\n val: T,\n sorter?: (a: string, b: string) => number,\n) {\n const output1 = ddecompose(val, '');\n output1.sort(sorter ?? sortMap);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2;\n}\n"],"names":["DELIMITER","isPrimitive","sortMap"],"mappings":";;;;;;AAKA;AACA,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAA;AACrC,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAChC,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AAC9B,QAAA,MAAM,QAAQ,GAAGC,mBAAW,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AACnD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;SACxB;AACH,KAAC,CAAC,CAAC;AACH,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEe,SAAA,SAAS,CACvB,GAAM,EACN,MAAyC,EAAA;IAEzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,IAAIC,eAAO,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,MAAM,CAACF,2BAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAAO,CAAC;AACjB;;;;"}
1
+ {"version":3,"file":"decompose.cjs","sources":["../src/decompose.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport type { Decompose, Ru } from './types';\n\nfunction ddecompose(val: any, prev = '') {\n const _prev = prev ? prev + DELIMITER : '';\n const output: [string, any][] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n const values = ddecompose(value, `${_prev}${key}`);\n output.push(...values);\n } else output.push([`${_prev}${key}`, value]);\n });\n return output;\n}\n\nexport function decompose<T extends Ru>(val: T) {\n const entries1 = ddecompose(val, '');\n if (entries1.length == 0) return {} as Decompose<T>;\n const regex = new RegExp(DELIMITER, 'g');\n const entries2 = entries1.map(([key, value]) => [\n key.replace(regex, '.'),\n value,\n ]);\n const output = Object.fromEntries(entries2);\n return output as Decompose<T>;\n}\n"],"names":["DELIMITER","isPrimitive"],"mappings":";;;;;AAAA;AAKA,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAA;AACrC,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAGC,mBAAW,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AACnD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;SACxB;;AAAM,YAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,EAAE,KAAK,CAAC,CAAC,CAAC;AAChD,KAAC,CAAC,CAAC;AACH,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEK,SAAU,SAAS,CAAe,GAAM,EAAA;IAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACrC,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,EAAkB,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,MAAM,CAACD,2BAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC9C,QAAA,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACvB,KAAK;AACN,KAAA,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAA,OAAO,MAAsB,CAAC;AAChC;;;;"}
@@ -1,3 +1,3 @@
1
- import { Ru } from './types';
2
- export declare function decompose<T extends Ru>(val: T, sorter?: (a: string, b: string) => number): string[];
1
+ import type { Decompose, Ru } from './types';
2
+ export declare function decompose<T extends Ru>(val: T): Decompose<T>;
3
3
  //# sourceMappingURL=decompose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decompose.d.ts","sourceRoot":"","sources":["../src/decompose.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAkB7B,wBAAgB,SAAS,CAAC,CAAC,SAAS,EAAE,EACpC,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,YAQ1C"}
1
+ {"version":3,"file":"decompose.d.ts","sourceRoot":"","sources":["../src/decompose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAgB7C,wBAAgB,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,gBAU7C"}
@@ -0,0 +1,19 @@
1
+ export declare const ttest0: {};
2
+ export declare const ttest1: {
3
+ age: number;
4
+ name: string;
5
+ };
6
+ export declare const ttest2: {
7
+ _id: string;
8
+ data: {
9
+ name: {
10
+ firstName: string;
11
+ lastName: string;
12
+ };
13
+ };
14
+ statistics: {
15
+ updations: number;
16
+ deletions: number;
17
+ };
18
+ };
19
+ //# sourceMappingURL=decompose.fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decompose.fixtures.d.ts","sourceRoot":"","sources":["../src/decompose.fixtures.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,IAAK,CAAC;AACzB,eAAO,MAAM,MAAM;;;CAA8B,CAAC;AAClD,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC"}
package/lib/decompose.js CHANGED
@@ -1,28 +1,33 @@
1
1
  import { DELIMITER } from './constants/strings.js';
2
2
  import { isPrimitive } from './helpers.js';
3
- import { sortMap } from './sortMap.js';
4
3
 
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
5
  function ddecompose(val, prev = '') {
7
6
  const _prev = prev ? prev + DELIMITER : '';
8
7
  const output = [];
9
8
  const entries1 = Object.entries(val);
10
9
  entries1.forEach(([key, value]) => {
11
- output.push(`${_prev}${key}`);
12
10
  const isPrimit = isPrimitive(value);
13
11
  if (!isPrimit) {
14
12
  const values = ddecompose(value, `${_prev}${key}`);
15
13
  output.push(...values);
16
14
  }
15
+ else
16
+ output.push([`${_prev}${key}`, value]);
17
17
  });
18
18
  return output;
19
19
  }
20
- function decompose(val, sorter) {
21
- const output1 = ddecompose(val, '');
22
- output1.sort(sorter ?? sortMap);
20
+ function decompose(val) {
21
+ const entries1 = ddecompose(val, '');
22
+ if (entries1.length == 0)
23
+ return {};
23
24
  const regex = new RegExp(DELIMITER, 'g');
24
- const output2 = output1.map(value => value.replace(regex, '.'));
25
- return output2;
25
+ const entries2 = entries1.map(([key, value]) => [
26
+ key.replace(regex, '.'),
27
+ value,
28
+ ]);
29
+ const output = Object.fromEntries(entries2);
30
+ return output;
26
31
  }
27
32
 
28
33
  export { decompose };
@@ -1 +1 @@
1
- {"version":3,"file":"decompose.js","sources":["../src/decompose.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport { Ru } from './types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction ddecompose(val: any, prev = '') {\n const _prev = prev ? prev + DELIMITER : '';\n const output: string[] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n output.push(`${_prev}${key}`);\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n const values = ddecompose(value, `${_prev}${key}`);\n output.push(...values);\n }\n });\n return output;\n}\n\nexport function decompose<T extends Ru>(\n val: T,\n sorter?: (a: string, b: string) => number,\n) {\n const output1 = ddecompose(val, '');\n output1.sort(sorter ?? sortMap);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.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+ {"version":3,"file":"decompose.js","sources":["../src/decompose.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport type { Decompose, Ru } from './types';\n\nfunction ddecompose(val: any, prev = '') {\n const _prev = prev ? prev + DELIMITER : '';\n const output: [string, any][] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n const values = ddecompose(value, `${_prev}${key}`);\n output.push(...values);\n } else output.push([`${_prev}${key}`, value]);\n });\n return output;\n}\n\nexport function decompose<T extends Ru>(val: T) {\n const entries1 = ddecompose(val, '');\n if (entries1.length == 0) return {} as Decompose<T>;\n const regex = new RegExp(DELIMITER, 'g');\n const entries2 = entries1.map(([key, value]) => [\n key.replace(regex, '.'),\n value,\n ]);\n const output = Object.fromEntries(entries2);\n return output as Decompose<T>;\n}\n"],"names":[],"mappings":";;;AAAA;AAKA,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAA;AACrC,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AACnD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;SACxB;;AAAM,YAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,EAAE,KAAK,CAAC,CAAC,CAAC;AAChD,KAAC,CAAC,CAAC;AACH,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEK,SAAU,SAAS,CAAe,GAAM,EAAA;IAC5C,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACrC,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,EAAkB,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC9C,QAAA,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACvB,KAAK;AACN,KAAA,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAA,OAAO,MAAsB,CAAC;AAChC;;;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var constants_strings = require('./constants/strings.cjs');
4
+ var helpers = require('./helpers.cjs');
5
+ var sortMap = require('./sortMap.cjs');
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
9
+ const _prev = prev ? prev + constants_strings.DELIMITER : '';
10
+ const output = [];
11
+ const entries1 = Object.entries(val);
12
+ entries1.forEach(([key, value]) => {
13
+ const isPrimit = helpers.isPrimitive(value);
14
+ if (!isPrimit) {
15
+ if (addObjectKeys)
16
+ output.push(`${_prev}${key}`);
17
+ const values = ddecomposeKeys(value, `${_prev}${key}`, addObjectKeys);
18
+ output.push(...values);
19
+ }
20
+ else
21
+ output.push(`${_prev}${key}`);
22
+ });
23
+ return output;
24
+ }
25
+ function decomposeKeys(val, sorter = sortMap.sortMap, addObjectKeys) {
26
+ const output1 = ddecomposeKeys(val, '', addObjectKeys);
27
+ output1.sort(sorter);
28
+ const regex = new RegExp(constants_strings.DELIMITER, 'g');
29
+ const output2 = output1.map(value => value.replace(regex, '.'));
30
+ return output2;
31
+ }
32
+
33
+ exports.decomposeKeys = decomposeKeys;
34
+ //# sourceMappingURL=decomposeKeys.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decomposeKeys.cjs","sources":["../src/decomposeKeys.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport type { KeysMatching, Ru } from './types';\n\nfunction ddecomposeKeys(val: any, prev = '', addObjectKeys = true) {\n const _prev = prev ? prev + DELIMITER : '';\n const output: string[] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n if (addObjectKeys) output.push(`${_prev}${key}`);\n const values = ddecomposeKeys(\n value,\n `${_prev}${key}`,\n addObjectKeys,\n );\n output.push(...values);\n } else output.push(`${_prev}${key}`);\n });\n return output;\n}\n\nexport function decomposeKeys<\n T extends Ru,\n AddObjectKeys extends boolean = true,\n>(val: T, sorter = sortMap, addObjectKeys?: AddObjectKeys) {\n const output1 = ddecomposeKeys(val, '', addObjectKeys);\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as KeysMatching<T, true>[];\n}\n"],"names":["DELIMITER","isPrimitive","sortMap"],"mappings":";;;;;;AAAA;AAMA,SAAS,cAAc,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,aAAa,GAAG,IAAI,EAAA;AAC/D,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE,CAAC;IAC3C,MAAM,MAA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Ru } from './types';
3
+ export declare function decomposeKeys<T extends Ru, AddObjectKeys extends boolean = true>(val: T, sorter?: typeof sortMap, addObjectKeys?: AddObjectKeys): KeysMatching<T, true>[];
4
+ //# sourceMappingURL=decomposeKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decomposeKeys.d.ts","sourceRoot":"","sources":["../src/decomposeKeys.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAqBhD,wBAAgB,aAAa,CAC3B,CAAC,SAAS,EAAE,EACZ,aAAa,SAAS,OAAO,GAAG,IAAI,EACpC,GAAG,EAAE,CAAC,EAAE,MAAM,iBAAU,EAAE,aAAa,CAAC,EAAE,aAAa,2BAOxD"}
@@ -0,0 +1,32 @@
1
+ import { DELIMITER } from './constants/strings.js';
2
+ import { isPrimitive } from './helpers.js';
3
+ import { sortMap } from './sortMap.js';
4
+
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
7
+ const _prev = prev ? prev + DELIMITER : '';
8
+ const output = [];
9
+ const entries1 = Object.entries(val);
10
+ entries1.forEach(([key, value]) => {
11
+ const isPrimit = isPrimitive(value);
12
+ if (!isPrimit) {
13
+ if (addObjectKeys)
14
+ output.push(`${_prev}${key}`);
15
+ const values = ddecomposeKeys(value, `${_prev}${key}`, addObjectKeys);
16
+ output.push(...values);
17
+ }
18
+ else
19
+ output.push(`${_prev}${key}`);
20
+ });
21
+ return output;
22
+ }
23
+ function decomposeKeys(val, sorter = sortMap, addObjectKeys) {
24
+ const output1 = ddecomposeKeys(val, '', addObjectKeys);
25
+ output1.sort(sorter);
26
+ const regex = new RegExp(DELIMITER, 'g');
27
+ const output2 = output1.map(value => value.replace(regex, '.'));
28
+ return output2;
29
+ }
30
+
31
+ export { decomposeKeys };
32
+ //# sourceMappingURL=decomposeKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decomposeKeys.js","sources":["../src/decomposeKeys.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport type { KeysMatching, Ru } from './types';\n\nfunction ddecomposeKeys(val: any, prev = '', addObjectKeys = true) {\n const _prev = prev ? prev + DELIMITER : '';\n const output: string[] = [];\n const entries1 = Object.entries(val);\n entries1.forEach(([key, value]) => {\n const isPrimit = isPrimitive(value);\n if (!isPrimit) {\n if (addObjectKeys) output.push(`${_prev}${key}`);\n const values = ddecomposeKeys(\n value,\n `${_prev}${key}`,\n addObjectKeys,\n );\n output.push(...values);\n } else output.push(`${_prev}${key}`);\n });\n return output;\n}\n\nexport function decomposeKeys<\n T extends Ru,\n AddObjectKeys extends boolean = true,\n>(val: T, sorter = sortMap, addObjectKeys?: AddObjectKeys) {\n const output1 = ddecomposeKeys(val, '', addObjectKeys);\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as KeysMatching<T, true>[];\n}\n"],"names":[],"mappings":";;;;AAAA;AAMA,SAAS,cAAc,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,aAAa,GAAG,IAAI,EAAA;AAC/D,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,IAAI,aAAa;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AACjD,YAAA,MAAM,MAAM,GAAG,cAAc,CAC3B,KAAK,EACL,CAAA,EAAG,KAAK,CAAA,EAAG,GAAG,CAAA,CAAE,EAChB,aAAa,CACd,CAAC;AACF,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;SACxB;;YAAM,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;AACvC,KAAC,CAAC,CAAC;AACH,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEK,SAAU,aAAa,CAG3B,GAAM,EAAE,MAAM,GAAG,OAAO,EAAE,aAA6B,EAAA;IACvD,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC;AACvD,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAAkC,CAAC;AAC5C;;;;"}
@@ -16,9 +16,9 @@ function ddecompose(val, prev = '') {
16
16
  }
17
17
  return output;
18
18
  }
19
- function decomposeSV(val, sorter) {
19
+ function decomposeSV(val, sorter = sortMap.sortMap) {
20
20
  const output1 = ddecompose(val, '');
21
- output1.sort(sorter ?? sortMap.sortMap);
21
+ output1.sort(sorter);
22
22
  const regex = new RegExp(constants_strings.DELIMITER, 'g');
23
23
  const output2 = output1.map(value => value.replace(regex, '.'));
24
24
  return output2;
@@ -1 +1 @@
1
- {"version":3,"file":"decomposeSV.cjs","sources":["../src/decomposeSV.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n prev !== '' && output.push(prev);\n\n if (typeof val === 'string') {\n output.push(`${_prev}${val}`);\n } else {\n const keys = Object.keys(val);\n output.push(\n ...keys.map(key => ddecompose(val[key], `${_prev}${key}`)).flat(),\n );\n }\n\n return output;\n}\n\nexport function decomposeSV<T extends StateValue>(\n val: T,\n sorter?: (a: string, b: string) => number,\n): readonly StateMatching<T>[] {\n const output1 = ddecompose(val, '');\n output1.sort(sorter ?? sortMap);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as StateMatching<T>[];\n}\n"],"names":["DELIMITER","sortMap"],"mappings":";;;;;AAIA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;AAE5B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE,CAAC;IAC3C,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEjC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;KAC/B;SAAM;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,QAAA,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC,CAAC,IAAI,EAAE,CAClE,CAAC;KACH;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEe,SAAA,WAAW,CACzB,GAAM,EACN,MAAyC,EAAA;IAEzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,IAAIC,eAAO,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,MAAM,CAACD,2BAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAA6B,CAAC;AACvC;;;;"}
1
+ {"version":3,"file":"decomposeSV.cjs","sources":["../src/decomposeSV.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n prev !== '' && output.push(prev);\n\n if (typeof val === 'string') {\n output.push(`${_prev}${val}`);\n } else {\n const keys = Object.keys(val);\n output.push(\n ...keys.map(key => ddecompose(val[key], `${_prev}${key}`)).flat(),\n );\n }\n\n return output;\n}\n\nexport function decomposeSV<T extends StateValue>(\n val: T,\n sorter = sortMap,\n) {\n const output1 = ddecompose(val, '');\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as StateMatching<T>[];\n}\n"],"names":["DELIMITER","sortMap"],"mappings":";;;;;AAIA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;AAE5B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE,CAAC;IAC3C,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEjC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;KAC/B;SAAM;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,QAAA,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC,CAAC,IAAI,EAAE,CAClE,CAAC;KACH;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;SAEe,WAAW,CACzB,GAAM,EACN,MAAM,GAAGC,eAAO,EAAA;IAEhB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,MAAM,CAACD,2BAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAA6B,CAAC;AACvC;;;;"}
@@ -1,3 +1,4 @@
1
+ import { sortMap } from './sortMap';
1
2
  import type { StateMatching, StateValue } from './types';
2
- export declare function decomposeSV<T extends StateValue>(val: T, sorter?: (a: string, b: string) => number): readonly StateMatching<T>[];
3
+ export declare function decomposeSV<T extends StateValue>(val: T, sorter?: typeof sortMap): StateMatching<T>[];
3
4
  //# sourceMappingURL=decomposeSV.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decomposeSV.d.ts","sourceRoot":"","sources":["../src/decomposeSV.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoBzD,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAC9C,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,GACxC,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,CAO7B"}
1
+ {"version":3,"file":"decomposeSV.d.ts","sourceRoot":"","sources":["../src/decomposeSV.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAoBzD,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAC9C,GAAG,EAAE,CAAC,EACN,MAAM,iBAAU,sBAQjB"}
@@ -14,9 +14,9 @@ function ddecompose(val, prev = '') {
14
14
  }
15
15
  return output;
16
16
  }
17
- function decomposeSV(val, sorter) {
17
+ function decomposeSV(val, sorter = sortMap) {
18
18
  const output1 = ddecompose(val, '');
19
- output1.sort(sorter ?? sortMap);
19
+ output1.sort(sorter);
20
20
  const regex = new RegExp(DELIMITER, 'g');
21
21
  const output2 = output1.map(value => value.replace(regex, '.'));
22
22
  return output2;
@@ -1 +1 @@
1
- {"version":3,"file":"decomposeSV.js","sources":["../src/decomposeSV.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n prev !== '' && output.push(prev);\n\n if (typeof val === 'string') {\n output.push(`${_prev}${val}`);\n } else {\n const keys = Object.keys(val);\n output.push(\n ...keys.map(key => ddecompose(val[key], `${_prev}${key}`)).flat(),\n );\n }\n\n return output;\n}\n\nexport function decomposeSV<T extends StateValue>(\n val: T,\n sorter?: (a: string, b: string) => number,\n): readonly StateMatching<T>[] {\n const output1 = ddecompose(val, '');\n output1.sort(sorter ?? sortMap);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as StateMatching<T>[];\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;AAE5B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;IAC3C,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEjC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;KAC/B;SAAM;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,QAAA,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC,CAAC,IAAI,EAAE,CAClE,CAAC;KACH;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;AAEe,SAAA,WAAW,CACzB,GAAM,EACN,MAAyC,EAAA;IAEzC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAA6B,CAAC;AACvC;;;;"}
1
+ {"version":3,"file":"decomposeSV.js","sources":["../src/decomposeSV.ts"],"sourcesContent":["import { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n prev !== '' && output.push(prev);\n\n if (typeof val === 'string') {\n output.push(`${_prev}${val}`);\n } else {\n const keys = Object.keys(val);\n output.push(\n ...keys.map(key => ddecompose(val[key], `${_prev}${key}`)).flat(),\n );\n }\n\n return output;\n}\n\nexport function decomposeSV<T extends StateValue>(\n val: T,\n sorter = sortMap,\n) {\n const output1 = ddecompose(val, '');\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n const output2 = output1.map(value => value.replace(regex, '.'));\n\n return output2 as StateMatching<T>[];\n}\n"],"names":[],"mappings":";;;AAIA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;AAE5B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE,CAAC;IAC3C,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEjC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC;KAC/B;SAAM;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9B,QAAA,MAAM,CAAC,IAAI,CACT,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC,CAAC,CAAC,IAAI,EAAE,CAClE,CAAC;KACH;AAED,IAAA,OAAO,MAAM,CAAC;AAChB,CAAC;SAEe,WAAW,CACzB,GAAM,EACN,MAAM,GAAG,OAAO,EAAA;IAEhB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AACpC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AACzC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhE,IAAA,OAAO,OAA6B,CAAC;AACvC;;;;"}
package/lib/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var decompose = require('./decompose.cjs');
4
+ var decomposeKeys = require('./decomposeKeys.cjs');
4
5
  var decomposeSV = require('./decomposeSV.cjs');
5
6
  var recompose = require('./recompose.cjs');
6
7
  var sortMap = require('./sortMap.cjs');
@@ -8,6 +9,7 @@ var sortMap = require('./sortMap.cjs');
8
9
 
9
10
 
10
11
  exports.decompose = decompose.decompose;
12
+ exports.decomposeKeys = decomposeKeys.decomposeKeys;
11
13
  exports.decomposeSV = decomposeSV.decomposeSV;
12
14
  exports.recompose = recompose.recompose;
13
15
  exports.recomposeObjectUrl = recompose.recomposeObjectUrl;
package/lib/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './decompose';
2
+ export * from './decomposeKeys';
2
3
  export * from './decomposeSV';
3
4
  export * from './recompose';
4
5
  export * from './sortMap';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { decompose } from './decompose.js';
2
+ export { decomposeKeys } from './decomposeKeys.js';
2
3
  export { decomposeSV } from './decomposeSV.js';
3
4
  export { recompose, recomposeObjectUrl } from './recompose.js';
4
5
  export { sortMap } from './sortMap.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/lib/types.d.ts CHANGED
@@ -1,4 +1,23 @@
1
- export type StateMatching<T extends Record<string, unknown> | string, Key = keyof T> = T extends Record<string, unknown> ? Key extends string ? T[Key] extends Record<string, unknown> ? `${Key}.${StateMatching<T[Key]>}` | (Key & string) : Key & string : never : T;
1
+ export type StateMatching<T extends StateValue, Key = keyof T> = T extends StateValueMap ? Key extends string ? T[Key] extends StateValueMap ? `${Key}.${StateMatching<T[Key]>}` | Key : `${Key}.${T[Key] & string}` | Key : never : T;
2
+ export type KeysMatching<T extends Ru, AddObjectKeys extends boolean = true, Key = keyof T> = Key extends string ? T[Key] extends Ru ? `${Key}.${KeysMatching<T[Key], AddObjectKeys> & string}` | (AddObjectKeys extends true ? Key : never) : Key : never;
3
+ type ToPaths<T, P extends string = ''> = T extends Ru ? {
4
+ [K in keyof T]: ToPaths<T[K], `${P}${K & string}.`>;
5
+ }[keyof T] : {
6
+ path: P extends `${infer P}.` ? P : never;
7
+ type: T;
8
+ };
9
+ type FromPaths<T extends {
10
+ path: string;
11
+ type: unknown;
12
+ }> = {
13
+ [P in T['path']]: Extract<T, {
14
+ path: P;
15
+ }>['type'];
16
+ };
17
+ /**
18
+ * From "Acid Coder"
19
+ */
20
+ export type Decompose<T extends Ru> = FromPaths<ToPaths<T>>;
2
21
  export type LengthOf<T> = T extends ReadonlyArray<unknown> ? T['length'] : number;
3
22
  export type DecomposeOptions = {
4
23
  delimiter?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAC1C,GAAG,GAAG,MAAM,CAAC,IAEb,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,GAAG,SAAS,MAAM,GAChB,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACpC,GAAG,GAAG,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,GAClD,GAAG,GAAG,MAAM,GACd,KAAK,GACP,CAAC,CAAC;AAER,MAAM,MAAM,QAAQ,CAAC,CAAC,IACpB,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;AAE1D,MAAM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,CAAC,EAAE,GAC9B,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAC7B,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAC5B,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GACnB,CAAC,CAAC,GAAG,CAAC,CACX;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemedev/decompose",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Decompose object and so more",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -57,14 +57,10 @@
57
57
  "@bemedev/fsf": "^0.7.0",
58
58
  "@bemedev/vitest-alias": "^0.0.2",
59
59
  "@bemedev/vitest-extended": "^0.3.3",
60
- "@types/deep-diff": "^1.0.5",
61
60
  "@types/node": "^20.12.8",
62
61
  "@typescript-eslint/eslint-plugin": "^7.7.1",
63
62
  "@typescript-eslint/parser": "^7.7.1",
64
63
  "@vitest/coverage-v8": "^1.5.2",
65
- "@xstate/immer": "^0.3.3",
66
- "dequal": "^2.0.3",
67
- "esbuild": "^0.20.2",
68
64
  "eslint": "^8.57.0",
69
65
  "glob": "^10.3.12",
70
66
  "husky": "^9.0.11",
@@ -78,14 +74,9 @@
78
74
  "tsd": "^0.31.0",
79
75
  "tslib": "^2.6.2",
80
76
  "typescript": "^5.4.4",
81
- "vitest": "^1.5.2",
82
- "xstate": "^4.38.3",
83
- "zod": "^3.23.4"
77
+ "vitest": "^1.5.2"
84
78
  },
85
79
  "dependencies": {
86
- "@bemedev/decompose": "^0.1.6",
87
- "@bemedev/usefull-functions": "^0.1.1",
88
- "firebase": "^10.11.1",
89
80
  "ts-deepmerge": "^7.0.0"
90
81
  }
91
82
  }