@bemedev/decompose 0.7.3 → 0.8.1

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/README.md CHANGED
@@ -1 +1,73 @@
1
- ## Decompose object to string paths
1
+ # @bemedev/decompose
2
+
3
+ Utility library for decomposing and recomposing objects in
4
+ JavaScript/TypeScript.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @bemedev/decompose
10
+ # or
11
+ pnpm add @bemedev/decompose
12
+ # or
13
+ yarn add @bemedev/decompose
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```typescript
19
+ import { decompose, recompose } from '@bemedev/decompose';
20
+
21
+ const obj = {
22
+ data: {
23
+ name: {
24
+ firstName: 'John',
25
+ lastName: 'Doe',
26
+ },
27
+ },
28
+ };
29
+
30
+ const decomposed = decompose(obj);
31
+ // Result: { 'data.name.firstName': 'John', 'data.name.lastName': 'Doe' }
32
+
33
+ const recomposed = recompose(decomposed);
34
+ // Returns original object structure
35
+ ```
36
+
37
+ ## Changelog
38
+
39
+ <details>
40
+ <summary>View changelog</summary>
41
+
42
+ ### [0.8.1] - 2024-03-15 19:30
43
+
44
+ - Fix decompose array
45
+
46
+ <br/>
47
+
48
+ ### [0.8.0] - 2024-02-18 19:30
49
+
50
+ - Initial public release
51
+ - Added core decompose functionality
52
+ - Added recompose function
53
+ - Added TypeScript support
54
+
55
+ </details>
56
+
57
+ ## License
58
+
59
+ MIT
60
+
61
+ ## Auteur
62
+
63
+ chlbri (bri_lvi@icloud.com)
64
+
65
+ [My github](https://github.com/chlbri?tab=repositories)
66
+
67
+ [<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>](https://github.com/chlbri?tab=repositories)
68
+
69
+ <br/>
70
+
71
+ ## Liens
72
+
73
+ - [Documentation](https://github.com/chlbri/types)
@@ -1 +1 @@
1
- {"version":3,"file":"strings.cjs","sources":["../../src/constants/strings.ts"],"sourcesContent":["export const DELIMITER = '-{/./:}-' as const;\nexport const SEPARATOR = '.' as const;\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS,GAAG,WAAoB;AACtC,MAAM,SAAS,GAAG;;;;;"}
1
+ {"version":3,"file":"strings.cjs","sources":["../../src/constants/strings.ts"],"sourcesContent":["export const DELIMITER = '-{/./:}-' as const;\nexport const SEPARATOR = '.' as const;\n"],"names":[],"mappings":";;AAAO,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/constants/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAsB,CAAC;AAC7C,eAAO,MAAM,SAAS,KAAe,CAAC"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/constants/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,EAAG,UAAmB,CAAC;AAC7C,eAAO,MAAM,SAAS,EAAG,GAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"strings.js","sources":["../../src/constants/strings.ts"],"sourcesContent":["export const DELIMITER = '-{/./:}-' as const;\nexport const SEPARATOR = '.' as const;\n"],"names":[],"mappings":"AAAO,MAAM,SAAS,GAAG,WAAoB;AACtC,MAAM,SAAS,GAAG;;;;"}
1
+ {"version":3,"file":"strings.js","sources":["../../src/constants/strings.ts"],"sourcesContent":["export const DELIMITER = '-{/./:}-' as const;\nexport const SEPARATOR = '.' as const;\n"],"names":[],"mappings":"AAAO,MAAM,SAAS,GAAG;AAClB,MAAM,SAAS,GAAG;;;;"}
package/lib/decompose.cjs CHANGED
@@ -3,13 +3,12 @@
3
3
  var constants_strings = require('./constants/strings.cjs');
4
4
  var helpers = require('./helpers.cjs');
5
5
 
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
6
  function ddecompose(val, prev = '') {
8
7
  const _prev = prev ? prev + constants_strings.DELIMITER : '';
9
8
  const output = [];
10
9
  const entries1 = Object.entries(val);
11
10
  entries1.forEach(([key, value]) => {
12
- const isPrimit = helpers.isPrimitive(value);
11
+ const isPrimit = helpers.isPrimitive(value) || Array.isArray(value);
13
12
  if (!isPrimit) {
14
13
  const values = ddecompose(value, `${_prev}${key}`);
15
14
  output.push(...values);
@@ -19,7 +18,7 @@ function ddecompose(val, prev = '') {
19
18
  });
20
19
  return output;
21
20
  }
22
- function decompose(val) {
21
+ const _decompose = val => {
23
22
  const entries1 = ddecompose(val, '');
24
23
  if (entries1.length == 0)
25
24
  return {};
@@ -30,7 +29,11 @@ function decompose(val) {
30
29
  ]);
31
30
  const output = Object.fromEntries(entries2);
32
31
  return output;
33
- }
32
+ };
33
+ /* v8 ignore next 1 */
34
+ const decompose = val => _decompose(val);
35
+ decompose.low = _decompose;
36
+ decompose.strict = _decompose;
34
37
 
35
38
  exports.decompose = decompose;
36
39
  //# sourceMappingURL=decompose.cjs.map
@@ -1 +1 @@
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
+ {"version":3,"file":"decompose.cjs","sources":["../src/decompose.ts"],"sourcesContent":["import type { TrueObject } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport type { Decompose } from './types.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) || Array.isArray(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\ntype Decompose_F = <T extends TrueObject>(val: T) => Decompose<T>;\ntype _Decompose_F = (val: any) => any;\n\nexport type Decomposer = Decompose_F & {\n strict: Decompose_F;\n low: _Decompose_F;\n};\n\nconst _decompose: _Decompose_F = val => {\n const entries1 = ddecompose(val, '');\n if (entries1.length == 0) return {};\n\n const regex = new RegExp(DELIMITER, 'g');\n const entries2 = entries1.map(([key, value]) => [\n key.replace(regex, '.'),\n value,\n ]);\n\n const output = Object.fromEntries(entries2);\n return output;\n};\n\n/* v8 ignore next 1 */\nexport const decompose: Decomposer = val => _decompose(val);\ndecompose.low = _decompose;\ndecompose.strict = _decompose;\n"],"names":["DELIMITER","isPrimitive"],"mappings":";;;;;AAKA,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAA;AACrC,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE;IAC1C,MAAM,MAAM,GAAoB,EAAE;IAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAGC,mBAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AAClD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;;;AACjB,YAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,EAAE,KAAK,CAAC,CAAC;AAC/C,KAAC,CAAC;AACF,IAAA,OAAO,MAAM;AACf;AAUA,MAAM,UAAU,GAAiB,GAAG,IAAG;IACrC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;AACpC,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,EAAE;IAEnC,MAAM,KAAK,GAAG,IAAI,MAAM,CAACD,2BAAS,EAAE,GAAG,CAAC;AACxC,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;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC3C,IAAA,OAAO,MAAM;AACf,CAAC;AAED;AACO,MAAM,SAAS,GAAe,GAAG,IAAI,UAAU,CAAC,GAAG;AAC1D,SAAS,CAAC,GAAG,GAAG,UAAU;AAC1B,SAAS,CAAC,MAAM,GAAG,UAAU;;;;"}
@@ -1,3 +1,11 @@
1
- import type { Decompose, Ru } from './types';
2
- export declare function decompose<T extends Ru>(val: T): Decompose<T>;
1
+ import type { TrueObject } from '@bemedev/types';
2
+ import type { Decompose } from './types.types';
3
+ type Decompose_F = <T extends TrueObject>(val: T) => Decompose<T>;
4
+ type _Decompose_F = (val: any) => any;
5
+ export type Decomposer = Decompose_F & {
6
+ strict: Decompose_F;
7
+ low: _Decompose_F;
8
+ };
9
+ export declare const decompose: Decomposer;
10
+ export {};
3
11
  //# sourceMappingURL=decompose.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"decompose.d.ts","sourceRoot":"","sources":["../src/decompose.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAgB/C,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;AAClE,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;CACnB,CAAC;AAiBF,eAAO,MAAM,SAAS,EAAE,UAAmC,CAAC"}
package/lib/decompose.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import { DELIMITER } from './constants/strings.js';
2
2
  import { isPrimitive } from './helpers.js';
3
3
 
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
4
  function ddecompose(val, prev = '') {
6
5
  const _prev = prev ? prev + DELIMITER : '';
7
6
  const output = [];
8
7
  const entries1 = Object.entries(val);
9
8
  entries1.forEach(([key, value]) => {
10
- const isPrimit = isPrimitive(value);
9
+ const isPrimit = isPrimitive(value) || Array.isArray(value);
11
10
  if (!isPrimit) {
12
11
  const values = ddecompose(value, `${_prev}${key}`);
13
12
  output.push(...values);
@@ -17,7 +16,7 @@ function ddecompose(val, prev = '') {
17
16
  });
18
17
  return output;
19
18
  }
20
- function decompose(val) {
19
+ const _decompose = val => {
21
20
  const entries1 = ddecompose(val, '');
22
21
  if (entries1.length == 0)
23
22
  return {};
@@ -28,7 +27,11 @@ function decompose(val) {
28
27
  ]);
29
28
  const output = Object.fromEntries(entries2);
30
29
  return output;
31
- }
30
+ };
31
+ /* v8 ignore next 1 */
32
+ const decompose = val => _decompose(val);
33
+ decompose.low = _decompose;
34
+ decompose.strict = _decompose;
32
35
 
33
36
  export { decompose };
34
37
  //# sourceMappingURL=decompose.js.map
@@ -1 +1 @@
1
- {"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;;;;"}
1
+ {"version":3,"file":"decompose.js","sources":["../src/decompose.ts"],"sourcesContent":["import type { TrueObject } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport type { Decompose } from './types.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) || Array.isArray(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\ntype Decompose_F = <T extends TrueObject>(val: T) => Decompose<T>;\ntype _Decompose_F = (val: any) => any;\n\nexport type Decomposer = Decompose_F & {\n strict: Decompose_F;\n low: _Decompose_F;\n};\n\nconst _decompose: _Decompose_F = val => {\n const entries1 = ddecompose(val, '');\n if (entries1.length == 0) return {};\n\n const regex = new RegExp(DELIMITER, 'g');\n const entries2 = entries1.map(([key, value]) => [\n key.replace(regex, '.'),\n value,\n ]);\n\n const output = Object.fromEntries(entries2);\n return output;\n};\n\n/* v8 ignore next 1 */\nexport const decompose: Decomposer = val => _decompose(val);\ndecompose.low = _decompose;\ndecompose.strict = _decompose;\n"],"names":[],"mappings":";;;AAKA,SAAS,UAAU,CAAC,GAAQ,EAAE,IAAI,GAAG,EAAE,EAAA;AACrC,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE;IAC1C,MAAM,MAAM,GAAoB,EAAE;IAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AAClD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;;;AACjB,YAAA,MAAM,CAAC,IAAI,CAAC,CAAC,CAAG,EAAA,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,EAAE,KAAK,CAAC,CAAC;AAC/C,KAAC,CAAC;AACF,IAAA,OAAO,MAAM;AACf;AAUA,MAAM,UAAU,GAAiB,GAAG,IAAG;IACrC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;AACpC,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,EAAE;IAEnC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC;AACxC,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;IAEF,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC3C,IAAA,OAAO,MAAM;AACf,CAAC;AAED;AACO,MAAM,SAAS,GAAe,GAAG,IAAI,UAAU,CAAC,GAAG;AAC1D,SAAS,CAAC,GAAG,GAAG,UAAU;AAC1B,SAAS,CAAC,MAAM,GAAG,UAAU;;;;"}
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var types = require('@bemedev/types');
3
4
  var constants_strings = require('./constants/strings.cjs');
4
5
  var helpers = require('./helpers.cjs');
5
6
  var sortMap = require('./sortMap.cjs');
6
7
 
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
8
  function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
9
9
  const _prev = prev ? prev + constants_strings.DELIMITER : '';
10
10
  const output = [];
@@ -22,13 +22,17 @@ function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
22
22
  });
23
23
  return output;
24
24
  }
25
- function decomposeKeys(val, sorter = sortMap.sortMap, addObjectKeys) {
25
+ const _decomposeKeys = (val, sorter = sortMap.sortMap, addObjectKeys = true) => {
26
26
  const output1 = ddecomposeKeys(val, '', addObjectKeys);
27
27
  output1.sort(sorter);
28
28
  const regex = new RegExp(constants_strings.DELIMITER, 'g');
29
- const output2 = output1.map(value => value.replace(regex, '.'));
30
- return output2;
31
- }
29
+ return output1.map(value => value.replace(regex, '.'));
30
+ };
31
+ const decomposeKeys = (val, sorter, addObjectKeys) => {
32
+ return types.t.any(_decomposeKeys(val, sorter, addObjectKeys));
33
+ };
34
+ decomposeKeys.low = _decomposeKeys;
35
+ decomposeKeys.strict = types.t.unknown(_decomposeKeys);
32
36
 
33
37
  exports.decomposeKeys = decomposeKeys;
34
38
  //# sourceMappingURL=decomposeKeys.cjs.map
@@ -1 +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,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,GAAGC,mBAAW,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,GAAGC,eAAO,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,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,OAAkC,CAAC;AAC5C;;;;"}
1
+ {"version":3,"file":"decomposeKeys.cjs","sources":["../src/decomposeKeys.ts"],"sourcesContent":["import { t } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport type { KeysMatching, Ru } from './types.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\ntype DecomposeKeys_F = <\n T extends Ru,\n AddObjectKeys extends boolean = true,\n>(\n val: T,\n sorter?: typeof sortMap,\n addObjectKeys?: AddObjectKeys,\n) => KeysMatching<T, AddObjectKeys>[];\n\ntype _DecomposeKeys_F = (\n val: any,\n sorter?: typeof sortMap,\n addObjectKeys?: boolean,\n) => string[];\n\nexport type DecomposeKeys = DecomposeKeys_F & {\n strict: DecomposeKeys_F;\n low: _DecomposeKeys_F;\n};\n\nconst _decomposeKeys: _DecomposeKeys_F = (\n val,\n sorter = sortMap,\n addObjectKeys = true,\n) => {\n const output1 = ddecomposeKeys(val, '', addObjectKeys);\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n return output1.map(value => value.replace(regex, '.'));\n};\n\nexport const decomposeKeys: DecomposeKeys = (\n val,\n sorter,\n addObjectKeys,\n) => {\n return t.any(_decomposeKeys(val, sorter, addObjectKeys));\n};\ndecomposeKeys.low = _decomposeKeys;\ndecomposeKeys.strict = t.unknown<DecomposeKeys_F>(_decomposeKeys);\n"],"names":["DELIMITER","isPrimitive","sortMap","t"],"mappings":";;;;;;;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;IAC1C,MAAM,MAAM,GAAa,EAAE;IAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC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 +1,11 @@
1
1
  import { sortMap } from './sortMap';
2
- import type { KeysMatching, 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>[];
2
+ import type { KeysMatching, Ru } from './types.types';
3
+ type DecomposeKeys_F = <T extends Ru, AddObjectKeys extends boolean = true>(val: T, sorter?: typeof sortMap, addObjectKeys?: AddObjectKeys) => KeysMatching<T, AddObjectKeys>[];
4
+ type _DecomposeKeys_F = (val: any, sorter?: typeof sortMap, addObjectKeys?: boolean) => string[];
5
+ export type DecomposeKeys = DecomposeKeys_F & {
6
+ strict: DecomposeKeys_F;
7
+ low: _DecomposeKeys_F;
8
+ };
9
+ export declare const decomposeKeys: DecomposeKeys;
10
+ export {};
4
11
  //# sourceMappingURL=decomposeKeys.d.ts.map
@@ -1 +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,GAMrC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAC1C"}
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,eAAe,CAAC;AAqBtD,KAAK,eAAe,GAAG,CACrB,CAAC,SAAS,EAAE,EACZ,aAAa,SAAS,OAAO,GAAG,IAAI,EAEpC,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,OAAO,OAAO,EACvB,aAAa,CAAC,EAAE,aAAa,KAC1B,YAAY,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;AAEtC,KAAK,gBAAgB,GAAG,CACtB,GAAG,EAAE,GAAG,EACR,MAAM,CAAC,EAAE,OAAO,OAAO,EACvB,aAAa,CAAC,EAAE,OAAO,KACpB,MAAM,EAAE,CAAC;AAEd,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,GAAG,EAAE,gBAAgB,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,aAAa,EAAE,aAM3B,CAAC"}
@@ -1,8 +1,8 @@
1
+ import { t } from '@bemedev/types';
1
2
  import { DELIMITER } from './constants/strings.js';
2
3
  import { isPrimitive } from './helpers.js';
3
4
  import { sortMap } from './sortMap.js';
4
5
 
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
6
  function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
7
7
  const _prev = prev ? prev + DELIMITER : '';
8
8
  const output = [];
@@ -20,13 +20,17 @@ function ddecomposeKeys(val, prev = '', addObjectKeys = true) {
20
20
  });
21
21
  return output;
22
22
  }
23
- function decomposeKeys(val, sorter = sortMap, addObjectKeys) {
23
+ const _decomposeKeys = (val, sorter = sortMap, addObjectKeys = true) => {
24
24
  const output1 = ddecomposeKeys(val, '', addObjectKeys);
25
25
  output1.sort(sorter);
26
26
  const regex = new RegExp(DELIMITER, 'g');
27
- const output2 = output1.map(value => value.replace(regex, '.'));
28
- return output2;
29
- }
27
+ return output1.map(value => value.replace(regex, '.'));
28
+ };
29
+ const decomposeKeys = (val, sorter, addObjectKeys) => {
30
+ return t.any(_decomposeKeys(val, sorter, addObjectKeys));
31
+ };
32
+ decomposeKeys.low = _decomposeKeys;
33
+ decomposeKeys.strict = t.unknown(_decomposeKeys);
30
34
 
31
35
  export { decomposeKeys };
32
36
  //# sourceMappingURL=decomposeKeys.js.map
@@ -1 +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;;;;"}
1
+ {"version":3,"file":"decomposeKeys.js","sources":["../src/decomposeKeys.ts"],"sourcesContent":["import { t } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { isPrimitive } from './helpers';\nimport { sortMap } from './sortMap';\nimport type { KeysMatching, Ru } from './types.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\ntype DecomposeKeys_F = <\n T extends Ru,\n AddObjectKeys extends boolean = true,\n>(\n val: T,\n sorter?: typeof sortMap,\n addObjectKeys?: AddObjectKeys,\n) => KeysMatching<T, AddObjectKeys>[];\n\ntype _DecomposeKeys_F = (\n val: any,\n sorter?: typeof sortMap,\n addObjectKeys?: boolean,\n) => string[];\n\nexport type DecomposeKeys = DecomposeKeys_F & {\n strict: DecomposeKeys_F;\n low: _DecomposeKeys_F;\n};\n\nconst _decomposeKeys: _DecomposeKeys_F = (\n val,\n sorter = sortMap,\n addObjectKeys = true,\n) => {\n const output1 = ddecomposeKeys(val, '', addObjectKeys);\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n return output1.map(value => value.replace(regex, '.'));\n};\n\nexport const decomposeKeys: DecomposeKeys = (\n val,\n sorter,\n addObjectKeys,\n) => {\n return t.any(_decomposeKeys(val, sorter, addObjectKeys));\n};\ndecomposeKeys.low = _decomposeKeys;\ndecomposeKeys.strict = t.unknown<DecomposeKeys_F>(_decomposeKeys);\n"],"names":[],"mappings":";;;;;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;IAC1C,MAAM,MAAM,GAAa,EAAE;IAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAChC,QAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC;QACnC,IAAI,CAAC,QAAQ,EAAE;AACb,YAAA,IAAI,aAAa;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AAChD,YAAA,MAAM,MAAM,GAAG,cAAc,CAC3B,KAAK,EACL,CAAA,EAAG,KAAK,CAAA,EAAG,GAAG,CAAA,CAAE,EAChB,aAAa,CACd;AACD,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;;;YACjB,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;AACtC,KAAC,CAAC;AACF,IAAA,OAAO,MAAM;AACf;AAsBA,MAAM,cAAc,GAAqB,CACvC,GAAG,EACH,MAAM,GAAG,OAAO,EAChB,aAAa,GAAG,IAAI,KAClB;IACF,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,EAAE,EAAE,EAAE,aAAa,CAAC;AACtD,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IACpB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC;AACxC,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAEY,MAAA,aAAa,GAAkB,CAC1C,GAAG,EACH,MAAM,EACN,aAAa,KACX;AACF,IAAA,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AAC1D;AACA,aAAa,CAAC,GAAG,GAAG,cAAc;AAClC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAkB,cAAc,CAAC;;;;"}
@@ -1,12 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var types = require('@bemedev/types');
3
4
  var constants_strings = require('./constants/strings.cjs');
4
5
  var sortMap = require('./sortMap.cjs');
5
6
 
6
7
  function ddecompose(val, prev = '') {
7
8
  const output = [];
8
9
  const _prev = prev ? prev + constants_strings.DELIMITER : '';
9
- prev !== '' && output.push(prev);
10
+ if (prev !== '')
11
+ output.push(prev);
10
12
  if (typeof val === 'string') {
11
13
  output.push(`${_prev}${val}`);
12
14
  }
@@ -16,13 +18,18 @@ function ddecompose(val, prev = '') {
16
18
  }
17
19
  return output;
18
20
  }
19
- function decomposeSV(val, sorter = sortMap.sortMap) {
21
+ const _decomposeSV = (val, sorter = sortMap.sortMap) => {
20
22
  const output1 = ddecompose(val, '');
21
23
  output1.sort(sorter);
22
24
  const regex = new RegExp(constants_strings.DELIMITER, 'g');
23
- const output2 = output1.map(value => value.replace(regex, '.'));
24
- return output2;
25
- }
25
+ return output1.map(value => value.replace(regex, '.'));
26
+ };
27
+ /* v8 ignore next 3 */
28
+ const decomposeSV = (val, sorter) => {
29
+ return types.t.any(_decomposeSV(val, sorter));
30
+ };
31
+ decomposeSV.low = _decomposeSV;
32
+ decomposeSV.strict = types.t.unknown(_decomposeSV);
26
33
 
27
34
  exports.decomposeSV = decomposeSV;
28
35
  //# sourceMappingURL=decomposeSV.cjs.map
@@ -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 = 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 State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ources":["../src/decomposeSV.ts"],"sourcesContent":["import { t } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types.types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n if (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\ntype DecomposeSV_F = <T extends StateValue>(\n val: T,\n sorter?: typeof sortMap,\n) => StateMatching<T>[];\n\ntype _DecomposeSV_F = (val: any, sorter?: typeof sortMap) => string[];\n\nexport type DecomposeSV = DecomposeSV_F & {\n strict: DecomposeSV_F;\n low: _DecomposeSV_F;\n};\n\nconst _decomposeSV: _DecomposeSV_F = (val, sorter = sortMap) => {\n const output1 = ddecompose(val, '');\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n return output1.map(value => value.replace(regex, '.'));\n};\n\n/* v8 ignore next 3 */\nexport const decomposeSV: DecomposeSV = (val, sorter) => {\n return t.any(_decomposeSV(val, sorter));\n};\ndecomposeSV.low = _decomposeSV;\ndecomposeSV.strict = t.unknown<DecomposeSV_F>(_decomposeSV);\n"],"names":["DELIMITER","sortMap","t"],"mappings":";;;;;;AAKA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE;AAE3B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAGA,2BAAS,GAAG,EAAE;IAC1C,IAAI,IAAI,KAAK,EAAE;AAAE,QAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;AAElC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;;SACxB;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC7B,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;;AAGH,IAAA,OAAO,MAAM;AACf;AAcA,MAAM,YAAY,GAAmB,CAAC,GAAG,EAAE,MAAM,GAAGC,eAAO,KAAI;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;AACnC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IACpB,MAAM,KAAK,GAAG,IAAI,MAAM,CAACD,2BAAS,EAAE,GAAG,CAAC;AACxC,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;MACa,WAAW,GAAgB,CAAC,GAAG,EAAE,MAAM,KAAI;IACtD,OAAOE,OAAC,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACzC;AACA,WAAW,CAAC,GAAG,GAAG,YAAY;AAC9B,WAAW,CAAC,MAAM,GAAGA,OAAC,CAAC,OAAO,CAAgB,YAAY,CAAC;;;;"}
@@ -1,4 +1,11 @@
1
1
  import { sortMap } from './sortMap';
2
- import type { StateMatching, StateValue } from './types';
3
- export declare function decomposeSV<T extends StateValue>(val: T, sorter?: typeof sortMap): StateMatching<T>[];
2
+ import type { StateMatching, StateValue } from './types.types';
3
+ type DecomposeSV_F = <T extends StateValue>(val: T, sorter?: typeof sortMap) => StateMatching<T>[];
4
+ type _DecomposeSV_F = (val: any, sorter?: typeof sortMap) => string[];
5
+ export type DecomposeSV = DecomposeSV_F & {
6
+ strict: DecomposeSV_F;
7
+ low: _DecomposeSV_F;
8
+ };
9
+ export declare const decomposeSV: DecomposeSV;
10
+ export {};
4
11
  //# sourceMappingURL=decomposeSV.d.ts.map
@@ -1 +1 @@
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,GAOE,aAAa,CAAC,CAAC,CAAC,EAAE,CACrC"}
1
+ {"version":3,"file":"decomposeSV.d.ts","sourceRoot":"","sources":["../src/decomposeSV.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoB/D,KAAK,aAAa,GAAG,CAAC,CAAC,SAAS,UAAU,EACxC,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,OAAO,OAAO,KACpB,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AAExB,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,OAAO,KAAK,MAAM,EAAE,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,MAAM,EAAE,aAAa,CAAC;IACtB,GAAG,EAAE,cAAc,CAAC;CACrB,CAAC;AAUF,eAAO,MAAM,WAAW,EAAE,WAEzB,CAAC"}
@@ -1,10 +1,12 @@
1
+ import { t } from '@bemedev/types';
1
2
  import { DELIMITER } from './constants/strings.js';
2
3
  import { sortMap } from './sortMap.js';
3
4
 
4
5
  function ddecompose(val, prev = '') {
5
6
  const output = [];
6
7
  const _prev = prev ? prev + DELIMITER : '';
7
- prev !== '' && output.push(prev);
8
+ if (prev !== '')
9
+ output.push(prev);
8
10
  if (typeof val === 'string') {
9
11
  output.push(`${_prev}${val}`);
10
12
  }
@@ -14,13 +16,18 @@ function ddecompose(val, prev = '') {
14
16
  }
15
17
  return output;
16
18
  }
17
- function decomposeSV(val, sorter = sortMap) {
19
+ const _decomposeSV = (val, sorter = sortMap) => {
18
20
  const output1 = ddecompose(val, '');
19
21
  output1.sort(sorter);
20
22
  const regex = new RegExp(DELIMITER, 'g');
21
- const output2 = output1.map(value => value.replace(regex, '.'));
22
- return output2;
23
- }
23
+ return output1.map(value => value.replace(regex, '.'));
24
+ };
25
+ /* v8 ignore next 3 */
26
+ const decomposeSV = (val, sorter) => {
27
+ return t.any(_decomposeSV(val, sorter));
28
+ };
29
+ decomposeSV.low = _decomposeSV;
30
+ decomposeSV.strict = t.unknown(_decomposeSV);
24
31
 
25
32
  export { decomposeSV };
26
33
  //# sourceMappingURL=decomposeSV.js.map
@@ -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 = 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;;;;"}
1
+ {"version":3,"file":"decomposeSV.js","sources":["../src/decomposeSV.ts"],"sourcesContent":["import { t } from '@bemedev/types';\nimport { DELIMITER } from './constants/strings';\nimport { sortMap } from './sortMap';\nimport type { StateMatching, StateValue } from './types.types';\n\nfunction ddecompose(val: StateValue, prev = '') {\n const output: string[] = [];\n\n const _prev = prev ? prev + DELIMITER : '';\n if (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\ntype DecomposeSV_F = <T extends StateValue>(\n val: T,\n sorter?: typeof sortMap,\n) => StateMatching<T>[];\n\ntype _DecomposeSV_F = (val: any, sorter?: typeof sortMap) => string[];\n\nexport type DecomposeSV = DecomposeSV_F & {\n strict: DecomposeSV_F;\n low: _DecomposeSV_F;\n};\n\nconst _decomposeSV: _DecomposeSV_F = (val, sorter = sortMap) => {\n const output1 = ddecompose(val, '');\n output1.sort(sorter);\n const regex = new RegExp(DELIMITER, 'g');\n return output1.map(value => value.replace(regex, '.'));\n};\n\n/* v8 ignore next 3 */\nexport const decomposeSV: DecomposeSV = (val, sorter) => {\n return t.any(_decomposeSV(val, sorter));\n};\ndecomposeSV.low = _decomposeSV;\ndecomposeSV.strict = t.unknown<DecomposeSV_F>(_decomposeSV);\n"],"names":[],"mappings":";;;;AAKA,SAAS,UAAU,CAAC,GAAe,EAAE,IAAI,GAAG,EAAE,EAAA;IAC5C,MAAM,MAAM,GAAa,EAAE;AAE3B,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,EAAE;IAC1C,IAAI,IAAI,KAAK,EAAE;AAAE,QAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;AAElC,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,CAAA,EAAG,KAAK,CAAG,EAAA,GAAG,CAAE,CAAA,CAAC;;SACxB;QACL,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC7B,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;;AAGH,IAAA,OAAO,MAAM;AACf;AAcA,MAAM,YAAY,GAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,KAAI;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;AACnC,IAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IACpB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC;AACxC,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED;MACa,WAAW,GAAgB,CAAC,GAAG,EAAE,MAAM,KAAI;IACtD,OAAO,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACzC;AACA,WAAW,CAAC,GAAG,GAAG,YAAY;AAC9B,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAgB,YAAY,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.cjs","sources":["../src/helpers.ts"],"sourcesContent":["type Primitive = string | number | boolean | null | undefined;\n\nexport function isPrimitive(arg: unknown): arg is Primitive {\n return (\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'boolean' ||\n arg === undefined ||\n arg === null\n );\n}\n"],"names":[],"mappings":";;AAEM,SAAU,WAAW,CAAC,GAAY,EAAA;AACtC,IAAA,QACE,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,SAAS;AACxB,QAAA,GAAG,KAAK,SAAS;QACjB,GAAG,KAAK,IAAI,EACZ;AACJ;;;;"}
1
+ {"version":3,"file":"helpers.cjs","sources":["../src/helpers.ts"],"sourcesContent":["type Primitive = string | number | boolean | null | undefined;\n\nexport function isPrimitive(arg: unknown): arg is Primitive {\n return (\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'boolean' ||\n arg === undefined ||\n arg === null\n );\n}\n"],"names":[],"mappings":";;AAEM,SAAU,WAAW,CAAC,GAAY,EAAA;AACtC,IAAA,QACE,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,SAAS;AACxB,QAAA,GAAG,KAAK,SAAS;QACjB,GAAG,KAAK,IAAI;AAEhB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../src/helpers.ts"],"sourcesContent":["type Primitive = string | number | boolean | null | undefined;\n\nexport function isPrimitive(arg: unknown): arg is Primitive {\n return (\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'boolean' ||\n arg === undefined ||\n arg === null\n );\n}\n"],"names":[],"mappings":"AAEM,SAAU,WAAW,CAAC,GAAY,EAAA;AACtC,IAAA,QACE,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,SAAS;AACxB,QAAA,GAAG,KAAK,SAAS;QACjB,GAAG,KAAK,IAAI,EACZ;AACJ;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../src/helpers.ts"],"sourcesContent":["type Primitive = string | number | boolean | null | undefined;\n\nexport function isPrimitive(arg: unknown): arg is Primitive {\n return (\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'boolean' ||\n arg === undefined ||\n arg === null\n );\n}\n"],"names":[],"mappings":"AAEM,SAAU,WAAW,CAAC,GAAY,EAAA;AACtC,IAAA,QACE,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,QAAQ;QACvB,OAAO,GAAG,KAAK,SAAS;AACxB,QAAA,GAAG,KAAK,SAAS;QACjB,GAAG,KAAK,IAAI;AAEhB;;;;"}
package/lib/index.d.ts CHANGED
@@ -3,5 +3,5 @@ export * from './decomposeKeys';
3
3
  export * from './decomposeSV';
4
4
  export * from './recompose';
5
5
  export * from './sortMap';
6
- export * from './types';
6
+ export * from './types.types';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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,eAAe,CAAC"}
package/lib/recompose.cjs CHANGED
@@ -3,7 +3,6 @@
3
3
  var tsDeepmerge = require('ts-deepmerge');
4
4
  var constants_strings = require('./constants/strings.cjs');
5
5
 
6
- /* eslint-disable @typescript-eslint/no-explicit-any */
7
6
  function recomposeObjectUrl(shape, value) {
8
7
  const obj = {};
9
8
  if (shape.length <= 0)
@@ -19,39 +18,17 @@ function recomposeObjectUrl(shape, value) {
19
18
  }
20
19
  return obj;
21
20
  }
22
- /**
23
- * Recompose a flatten object
24
- * @example
25
- *
26
- * { 'data.age': 10, 'human.login': 'login' }
27
- * will become
28
- * {
29
- data: {
30
- age: 10,
31
- },
32
- human: {
33
- login: 'login',
34
- },
35
- }
36
- * @remark
37
- * The generated typescript type takes too much ressources
38
-
39
- * @todo
40
- Add type to the return
41
- */
42
- function recompose(shape) {
21
+ const _recompose = shape => {
43
22
  const entries = Object.entries(shape);
44
23
  const arr = [];
45
24
  entries.forEach(([key, value]) => {
46
25
  arr.push(recomposeObjectUrl(key, value));
47
26
  });
48
- /**
49
- * @todo
50
- * Add a return type
51
- */
52
- const output = tsDeepmerge.merge(...arr);
53
- return output;
54
- }
27
+ return tsDeepmerge.merge(...arr);
28
+ };
29
+ const recompose = shape => _recompose(shape);
30
+ recompose.low = _recompose;
31
+ recompose.strict = _recompose;
55
32
 
56
33
  exports.recompose = recompose;
57
34
  exports.recomposeObjectUrl = recomposeObjectUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"recompose.cjs","sources":["../src/recompose.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { merge } from 'ts-deepmerge';\nimport { SEPARATOR } from './constants/strings';\nimport type { Recompose, Ru } from './types';\n\nexport function recomposeObjectUrl<T>(shape: string, value: T) {\n const obj: Ru = {};\n if (shape.length <= 0) return obj;\n\n const keys = shape.split(SEPARATOR);\n if (keys.length === 1) {\n const key = keys.shift();\n obj[key!] = value;\n } else {\n const key = keys.shift();\n obj[key!] = recomposeObjectUrl(keys.join(SEPARATOR), value);\n }\n\n return obj;\n}\n\n/**\n * Recompose a flatten object \n * @example\n * \n * { 'data.age': 10, 'human.login': 'login' }\n * will become\n * {\n data: {\n age: 10,\n },\n human: {\n login: 'login',\n },\n }\n * @remark \n * The generated typescript type takes too much ressources\n\n * @todo\n Add type to the return\n */\nexport function recompose<T extends Ru>(shape: T) {\n const entries = Object.entries(shape);\n const arr: any[] = [];\n entries.forEach(([key, value]) => {\n arr.push(recomposeObjectUrl(key, value));\n });\n /**\n * @todo\n * Add a return type\n */\n const output = merge(...arr);\n return output as Recompose<T>;\n}\n"],"names":["SEPARATOR","merge"],"mappings":";;;;;AAAA;AAKgB,SAAA,kBAAkB,CAAI,KAAa,EAAE,KAAQ,EAAA;IAC3D,MAAM,GAAG,GAAO,EAAE,CAAC;AACnB,IAAA,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,GAAG,CAAC;IAElC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAACA,2BAAS,CAAC,CAAC;AACpC,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACzB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,KAAK,CAAC;KACnB;SAAM;AACL,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACzB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAACA,2BAAS,CAAC,EAAE,KAAK,CAAC,CAAC;KAC7D;AAED,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,SAAS,CAAe,KAAQ,EAAA;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,GAAG,GAAU,EAAE,CAAC;IACtB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC/B,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3C,KAAC,CAAC,CAAC;AACH;;;AAGG;AACH,IAAA,MAAM,MAAM,GAAGC,iBAAK,CAAC,GAAG,GAAG,CAAC,CAAC;AAC7B,IAAA,OAAO,MAAsB,CAAC;AAChC;;;;;"}
1
+ {"version":3,"file":"recompose.cjs","sources":["../src/recompose.ts"],"sourcesContent":["import { merge } from 'ts-deepmerge';\nimport { SEPARATOR } from './constants/strings';\nimport type { Recompose, Ru } from './types.types';\n\nexport function recomposeObjectUrl<T>(shape: string, value: T) {\n const obj: Ru = {};\n if (shape.length <= 0) return obj;\n\n const keys = shape.split(SEPARATOR);\n if (keys.length === 1) {\n const key = keys.shift();\n obj[key!] = value;\n } else {\n const key = keys.shift();\n obj[key!] = recomposeObjectUrl(keys.join(SEPARATOR), value);\n }\n\n return obj;\n}\n\n/**\n * Recompose a flatten object \n * @example\n * \n * { 'data.age': 10, 'human.login': 'login' }\n * will become\n * {\n data: {\n age: 10,\n },\n human: {\n login: 'login',\n },\n }\n * @remark \n * The generated typescript type takes too much ressources\n\n * @todo\n Add type to the return\n */\ntype Recompose_F = <T extends Ru>(shape: T) => Recompose<T>;\ntype _Recompose_F = (shape: any) => any;\n\nexport type Recomposer = Recompose_F & {\n strict: Recompose_F;\n low: _Recompose_F;\n};\n\nconst _recompose: _Recompose_F = shape => {\n const entries = Object.entries(shape);\n const arr: any[] = [];\n entries.forEach(([key, value]) => {\n arr.push(recomposeObjectUrl(key, value));\n });\n return merge(...arr);\n};\n\nexport const recompose: Recomposer = shape => _recompose(shape);\nrecompose.low = _recompose;\nrecompose.strict = _recompose;\n"],"names":["SEPARATOR","merge"],"mappings":";;;;;AAIgB,SAAA,kBAAkB,CAAI,KAAa,EAAE,KAAQ,EAAA;IAC3D,MAAM,GAAG,GAAO,EAAE;AAClB,IAAA,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,GAAG;IAEjC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAACA,2BAAS,CAAC;AACnC,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE;AACxB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,KAAK;;SACZ;AACL,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE;AACxB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAACA,2BAAS,CAAC,EAAE,KAAK,CAAC;;AAG7D,IAAA,OAAO,GAAG;AACZ;AA8BA,MAAM,UAAU,GAAiB,KAAK,IAAG;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC,MAAM,GAAG,GAAU,EAAE;IACrB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC/B,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC1C,KAAC,CAAC;AACF,IAAA,OAAOC,iBAAK,CAAC,GAAG,GAAG,CAAC;AACtB,CAAC;AAEM,MAAM,SAAS,GAAe,KAAK,IAAI,UAAU,CAAC,KAAK;AAC9D,SAAS,CAAC,GAAG,GAAG,UAAU;AAC1B,SAAS,CAAC,MAAM,GAAG,UAAU;;;;;"}
@@ -1,4 +1,4 @@
1
- import type { Recompose, Ru } from './types';
1
+ import type { Recompose, Ru } from './types.types';
2
2
  export declare function recomposeObjectUrl<T>(shape: string, value: T): Ru;
3
3
  /**
4
4
  * Recompose a flatten object
@@ -20,5 +20,12 @@ export declare function recomposeObjectUrl<T>(shape: string, value: T): Ru;
20
20
  * @todo
21
21
  Add type to the return
22
22
  */
23
- export declare function recompose<T extends Ru>(shape: T): Recompose<T>;
23
+ type Recompose_F = <T extends Ru>(shape: T) => Recompose<T>;
24
+ type _Recompose_F = (shape: any) => any;
25
+ export type Recomposer = Recompose_F & {
26
+ strict: Recompose_F;
27
+ low: _Recompose_F;
28
+ };
29
+ export declare const recompose: Recomposer;
30
+ export {};
24
31
  //# sourceMappingURL=recompose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recompose.d.ts","sourceRoot":"","sources":["../src/recompose.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAc5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,GAW7B,SAAS,CAAC,CAAC,CAAC,CAC9B"}
1
+ {"version":3,"file":"recompose.d.ts","sourceRoot":"","sources":["../src/recompose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,MAc5D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;AAC5D,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,YAAY,CAAC;CACnB,CAAC;AAWF,eAAO,MAAM,SAAS,EAAE,UAAuC,CAAC"}
package/lib/recompose.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { merge } from 'ts-deepmerge';
2
2
  import { SEPARATOR } from './constants/strings.js';
3
3
 
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
4
  function recomposeObjectUrl(shape, value) {
6
5
  const obj = {};
7
6
  if (shape.length <= 0)
@@ -17,39 +16,17 @@ function recomposeObjectUrl(shape, value) {
17
16
  }
18
17
  return obj;
19
18
  }
20
- /**
21
- * Recompose a flatten object
22
- * @example
23
- *
24
- * { 'data.age': 10, 'human.login': 'login' }
25
- * will become
26
- * {
27
- data: {
28
- age: 10,
29
- },
30
- human: {
31
- login: 'login',
32
- },
33
- }
34
- * @remark
35
- * The generated typescript type takes too much ressources
36
-
37
- * @todo
38
- Add type to the return
39
- */
40
- function recompose(shape) {
19
+ const _recompose = shape => {
41
20
  const entries = Object.entries(shape);
42
21
  const arr = [];
43
22
  entries.forEach(([key, value]) => {
44
23
  arr.push(recomposeObjectUrl(key, value));
45
24
  });
46
- /**
47
- * @todo
48
- * Add a return type
49
- */
50
- const output = merge(...arr);
51
- return output;
52
- }
25
+ return merge(...arr);
26
+ };
27
+ const recompose = shape => _recompose(shape);
28
+ recompose.low = _recompose;
29
+ recompose.strict = _recompose;
53
30
 
54
31
  export { recompose, recomposeObjectUrl };
55
32
  //# sourceMappingURL=recompose.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"recompose.js","sources":["../src/recompose.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { merge } from 'ts-deepmerge';\nimport { SEPARATOR } from './constants/strings';\nimport type { Recompose, Ru } from './types';\n\nexport function recomposeObjectUrl<T>(shape: string, value: T) {\n const obj: Ru = {};\n if (shape.length <= 0) return obj;\n\n const keys = shape.split(SEPARATOR);\n if (keys.length === 1) {\n const key = keys.shift();\n obj[key!] = value;\n } else {\n const key = keys.shift();\n obj[key!] = recomposeObjectUrl(keys.join(SEPARATOR), value);\n }\n\n return obj;\n}\n\n/**\n * Recompose a flatten object \n * @example\n * \n * { 'data.age': 10, 'human.login': 'login' }\n * will become\n * {\n data: {\n age: 10,\n },\n human: {\n login: 'login',\n },\n }\n * @remark \n * The generated typescript type takes too much ressources\n\n * @todo\n Add type to the return\n */\nexport function recompose<T extends Ru>(shape: T) {\n const entries = Object.entries(shape);\n const arr: any[] = [];\n entries.forEach(([key, value]) => {\n arr.push(recomposeObjectUrl(key, value));\n });\n /**\n * @todo\n * Add a return type\n */\n const output = merge(...arr);\n return output as Recompose<T>;\n}\n"],"names":[],"mappings":";;;AAAA;AAKgB,SAAA,kBAAkB,CAAI,KAAa,EAAE,KAAQ,EAAA;IAC3D,MAAM,GAAG,GAAO,EAAE,CAAC;AACnB,IAAA,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,GAAG,CAAC;IAElC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACpC,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACzB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,KAAK,CAAC;KACnB;SAAM;AACL,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACzB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;KAC7D;AAED,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,SAAS,CAAe,KAAQ,EAAA;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,GAAG,GAAU,EAAE,CAAC;IACtB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC/B,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3C,KAAC,CAAC,CAAC;AACH;;;AAGG;AACH,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;AAC7B,IAAA,OAAO,MAAsB,CAAC;AAChC;;;;"}
1
+ {"version":3,"file":"recompose.js","sources":["../src/recompose.ts"],"sourcesContent":["import { merge } from 'ts-deepmerge';\nimport { SEPARATOR } from './constants/strings';\nimport type { Recompose, Ru } from './types.types';\n\nexport function recomposeObjectUrl<T>(shape: string, value: T) {\n const obj: Ru = {};\n if (shape.length <= 0) return obj;\n\n const keys = shape.split(SEPARATOR);\n if (keys.length === 1) {\n const key = keys.shift();\n obj[key!] = value;\n } else {\n const key = keys.shift();\n obj[key!] = recomposeObjectUrl(keys.join(SEPARATOR), value);\n }\n\n return obj;\n}\n\n/**\n * Recompose a flatten object \n * @example\n * \n * { 'data.age': 10, 'human.login': 'login' }\n * will become\n * {\n data: {\n age: 10,\n },\n human: {\n login: 'login',\n },\n }\n * @remark \n * The generated typescript type takes too much ressources\n\n * @todo\n Add type to the return\n */\ntype Recompose_F = <T extends Ru>(shape: T) => Recompose<T>;\ntype _Recompose_F = (shape: any) => any;\n\nexport type Recomposer = Recompose_F & {\n strict: Recompose_F;\n low: _Recompose_F;\n};\n\nconst _recompose: _Recompose_F = shape => {\n const entries = Object.entries(shape);\n const arr: any[] = [];\n entries.forEach(([key, value]) => {\n arr.push(recomposeObjectUrl(key, value));\n });\n return merge(...arr);\n};\n\nexport const recompose: Recomposer = shape => _recompose(shape);\nrecompose.low = _recompose;\nrecompose.strict = _recompose;\n"],"names":[],"mappings":";;;AAIgB,SAAA,kBAAkB,CAAI,KAAa,EAAE,KAAQ,EAAA;IAC3D,MAAM,GAAG,GAAO,EAAE;AAClB,IAAA,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;AAAE,QAAA,OAAO,GAAG;IAEjC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;AACnC,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;AACrB,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE;AACxB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,KAAK;;SACZ;AACL,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE;AACxB,QAAA,GAAG,CAAC,GAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;;AAG7D,IAAA,OAAO,GAAG;AACZ;AA8BA,MAAM,UAAU,GAAiB,KAAK,IAAG;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC,MAAM,GAAG,GAAU,EAAE;IACrB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;QAC/B,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC1C,KAAC,CAAC;AACF,IAAA,OAAO,KAAK,CAAC,GAAG,GAAG,CAAC;AACtB,CAAC;AAEM,MAAM,SAAS,GAAe,KAAK,IAAI,UAAU,CAAC,KAAK;AAC9D,SAAS,CAAC,GAAG,GAAG,UAAU;AAC1B,SAAS,CAAC,MAAM,GAAG,UAAU;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sortMap.cjs","sources":["../src/sortMap.ts"],"sourcesContent":["export function sortMap(a: string, b: string) {\n return a.localeCompare(b);\n}\n"],"names":[],"mappings":";;AAAgB,SAAA,OAAO,CAAC,CAAS,EAAE,CAAS,EAAA;AAC1C,IAAA,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5B;;;;"}
1
+ {"version":3,"file":"sortMap.cjs","sources":["../src/sortMap.ts"],"sourcesContent":["export function sortMap(a: string, b: string) {\n return a.localeCompare(b);\n}\n"],"names":[],"mappings":";;AAAgB,SAAA,OAAO,CAAC,CAAS,EAAE,CAAS,EAAA;AAC1C,IAAA,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAC3B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sortMap.js","sources":["../src/sortMap.ts"],"sourcesContent":["export function sortMap(a: string, b: string) {\n return a.localeCompare(b);\n}\n"],"names":[],"mappings":"AAAgB,SAAA,OAAO,CAAC,CAAS,EAAE,CAAS,EAAA;AAC1C,IAAA,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC5B;;;;"}
1
+ {"version":3,"file":"sortMap.js","sources":["../src/sortMap.ts"],"sourcesContent":["export function sortMap(a: string, b: string) {\n return a.localeCompare(b);\n}\n"],"names":[],"mappings":"AAAgB,SAAA,OAAO,CAAC,CAAS,EAAE,CAAS,EAAA;AAC1C,IAAA,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;AAC3B;;;;"}
@@ -1,11 +1,10 @@
1
+ import type { NotSubType, TrueObject } from '@bemedev/types';
1
2
  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
- type NotUndefined<T> = Exclude<T, undefined>;
3
- type NoU<T> = NotUndefined<T>;
4
- export type KeysMatching<T extends object, AddObjectKeys extends boolean = true, Key extends keyof T = keyof T> = Key extends string ? NoU<T[Key]> extends object ? `${Key}.${KeysMatching<NoU<T[Key]>, AddObjectKeys> & string}` | (AddObjectKeys extends true ? Key : never) : Key : never;
5
- type ToPaths<T, P extends string = ''> = T extends Ru ? {
6
- [K in keyof T]: ToPaths<T[K], `${P}${K & string}.`>;
7
- }[keyof T] : {
8
- path: P extends `${infer P}.` ? P : never;
3
+ export type KeysMatching<T extends TrueObject, AddObjectKeys extends boolean = true, Key extends keyof T = keyof T> = Key extends string ? Required<T[Key]> extends TrueObject ? `${Key}.${KeysMatching<Required<T[Key]>, AddObjectKeys> & string}` | (AddObjectKeys extends true ? Key : never) : Key : never;
4
+ type ToPaths<T, D extends string = '.', P extends string = ''> = T extends Ru ? Required<{
5
+ [K in keyof T]: ToPaths<T[K], D, `${P}${K & string}${D}`>;
6
+ }>[keyof T] : {
7
+ path: P extends `${infer P}${D}` ? P : never;
9
8
  type: T;
10
9
  };
11
10
  type FromPaths<T extends {
@@ -19,12 +18,8 @@ type FromPaths<T extends {
19
18
  /**
20
19
  * From "Acid Coder"
21
20
  */
22
- export type Decompose<T extends Ru> = FromPaths<ToPaths<T>>;
21
+ export type Decompose<T extends TrueObject, D extends string = '.'> = NotSubType<FromPaths<ToPaths<T, D>>, undefined>;
23
22
  export type LengthOf<T> = T extends ReadonlyArray<unknown> ? T['length'] : number;
24
- export type DecomposeOptions = {
25
- delimiter?: string;
26
- sorter?: (a: string, b: string) => number;
27
- };
28
23
  export type StateValue = string | StateValueMap;
29
24
  export interface StateValueMap {
30
25
  [key: string]: StateValue;
@@ -36,4 +31,4 @@ export type Recompose<T extends Ru> = {
36
31
  [key in keyof T as SplitSeparator<key & string>]: UnionToIntersection<key extends `${string}.${infer A}` ? A extends `${string}.${string}` ? Recompose<Record<A, T[key]>> : Record<A, T[key]> : T[key]>;
37
32
  };
38
33
  export {};
39
- //# sourceMappingURL=types.d.ts.map
34
+ //# sourceMappingURL=types.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.types.d.ts","sourceRoot":"","sources":["../src/types.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,UAAU,EACpB,GAAG,GAAG,MAAM,CAAC,IACX,CAAC,SAAS,aAAa,GACvB,GAAG,SAAS,MAAM,GAChB,CAAC,CAAC,GAAG,CAAC,SAAS,aAAa,GAC1B,GAAG,GAAG,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,GACvC,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,GACnC,KAAK,GACP,CAAC,CAAC;AAEN,MAAM,MAAM,YAAY,CACtB,CAAC,SAAS,UAAU,EACpB,aAAa,SAAS,OAAO,GAAG,IAAI,EACpC,GAAG,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAC3B,GAAG,SAAS,MAAM,GAClB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,UAAU,GAE7B,GAAG,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,CAAC,GAAG,MAAM,E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CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B;AAED,MAAM,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAKzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,OAAO,SAAS,CAAC,GAC3C,CAAC,GACD,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CACjD,CAAC,EAAE,MAAM,CAAC,KACP,IAAI,GACT,CAAC,GACD,KAAK,CAAC;AAEZ,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE,GACpE,CAAC,GACD,CAAC,CAAC;AAGN,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,EAAE,IAAI;KACnC,GAAG,IAAI,MAAM,CAAC,IAAI,cAAc,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,mBAAmB,CACnE,GAAG,SAAS,GAAG,MAAM,IAAI,MAAM,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.7.3",
3
+ "version": "0.8.1",
4
4
  "description": "Decompose object and so more",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -33,12 +33,14 @@
33
33
  "scripts": {
34
34
  "config": "pnpm install",
35
35
  "config:off": "pnpm run config --offline",
36
- "ci": "pnpm run config:off && pnpm run lint && pnpm run test && pnpm run build",
37
- "ci:online": "pnpm run config && pnpm run lint && pnpm run test && pnpm run build",
36
+ "ci": "pnpm run config:off && pnpm run lint && pnpm run test",
38
37
  "ci:admin": "pnpm run rm && pnpm run ci",
39
38
  "rollup": "rollup -c",
40
39
  "build": "rm -rf lib && pnpm run rollup",
40
+ "pretest": "pnpm run build",
41
+ "posttest": "pnpm run prettier && pnpm run p-q",
41
42
  "rm": "rm -rf node_modules pnpm-lock.yaml",
43
+ "p-q": "pretty-quick",
42
44
  "rinit": "pnpm run rm && pnpm run config",
43
45
  "rinit:off": "pnpm run rm && pnpm run config:off",
44
46
  "test": "pnpm run test:coverage --no-coverage",
@@ -51,32 +53,41 @@
51
53
  "lint": "pnpm run prettier && pnpm run eslint --fix",
52
54
  "lint-watch": "onchange --await-write-finish 5500 \"**/*\" -- pnpm run lint",
53
55
  "prepublishOnly": "",
54
- "prepare": "husky"
56
+ "prepare": "husky",
57
+ "upgrade": "pnpm upgrade --latest"
55
58
  },
56
59
  "devDependencies": {
57
- "@bemedev/fsf": "^0.7.0",
58
- "@bemedev/vitest-alias": "^0.0.2",
59
- "@bemedev/vitest-extended": "^0.3.3",
60
- "@types/node": "^20.12.8",
61
- "@typescript-eslint/eslint-plugin": "^7.7.1",
62
- "@typescript-eslint/parser": "^7.7.1",
63
- "@vitest/coverage-v8": "^1.5.2",
64
- "eslint": "^8.57.0",
65
- "glob": "^10.3.12",
66
- "husky": "^9.0.11",
67
- "immer": "^10.0.4",
60
+ "@bemedev/fsf": "^0.7.3",
61
+ "@bemedev/rollup-config": "^0.1.1",
62
+ "@bemedev/types": "^0.1.5",
63
+ "@bemedev/vitest-alias": "^0.0.3",
64
+ "@bemedev/vitest-exclude": "^0.0.2",
65
+ "@bemedev/vitest-extended": "^1.2.3",
66
+ "@eslint/eslintrc": "^3.2.0",
67
+ "@eslint/js": "^9.20.0",
68
+ "@types/node": "^22.13.4",
69
+ "@typescript-eslint/eslint-plugin": "^8.24.1",
70
+ "@typescript-eslint/parser": "^8.24.1",
71
+ "@vitest/coverage-v8": "^3.0.6",
72
+ "eslint": "^9.20.1",
73
+ "glob": "^11.0.1",
74
+ "globals": "^15.15.0",
75
+ "husky": "^9.1.7",
76
+ "immer": "^10.1.1",
68
77
  "onchange": "^7.1.0",
69
- "prettier": "^3.2.5",
78
+ "prettier": "^3.5.1",
70
79
  "pretty-quick": "^4.0.0",
71
- "rollup": "^4.14.1",
80
+ "rollup": "^4.34.8",
72
81
  "rollup-plugin-tsc-alias": "^1.1.2",
73
82
  "rollup-plugin-typescript2": "^0.36.0",
74
- "tsd": "^0.31.0",
75
- "tslib": "^2.6.2",
76
- "typescript": "^5.4.4",
77
- "vitest": "^1.5.2"
83
+ "tslib": "^2.8.1",
84
+ "typescript": "^5.7.3",
85
+ "vitest": "^3.0.6"
78
86
  },
79
87
  "dependencies": {
80
- "ts-deepmerge": "^7.0.0"
88
+ "ts-deepmerge": "^7.0.2"
89
+ },
90
+ "peerDependencies": {
91
+ "@bemedev/types": "^0.1.5"
81
92
  }
82
93
  }
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS,UAAU,EACpB,GAAG,GAAG,MAAM,CAAC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