@lionweb/utilities 0.6.13-beta.7 → 0.7.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/hashing.d.ts.map +1 -1
- package/dist/hashing.js +1 -1
- package/dist/hashing.js.map +1 -1
- package/dist/m3/diagrams/Mermaid-generator.d.ts.map +1 -1
- package/dist/m3/diagrams/Mermaid-generator.js +12 -32
- package/dist/m3/diagrams/Mermaid-generator.js.map +1 -1
- package/dist/m3/diagrams/PlantUML-generator.d.ts.map +1 -1
- package/dist/m3/diagrams/PlantUML-generator.js +14 -40
- package/dist/m3/diagrams/PlantUML-generator.js.map +1 -1
- package/dist/m3/infer-languages.d.ts +4 -3
- package/dist/m3/infer-languages.d.ts.map +1 -1
- package/dist/m3/infer-languages.js +2 -1
- package/dist/m3/infer-languages.js.map +1 -1
- package/dist/m3/textualizer.d.ts.map +1 -1
- package/dist/m3/textualizer.js +7 -20
- package/dist/m3/textualizer.js.map +1 -1
- package/dist/m3/ts-generation/textgen.d.ts.map +1 -1
- package/dist/m3/ts-generation/textgen.js.map +1 -1
- package/dist/m3/ts-generation/ts-types-generator.d.ts.map +1 -1
- package/dist/m3/ts-generation/ts-types-generator.js +26 -33
- package/dist/m3/ts-generation/ts-types-generator.js.map +1 -1
- package/dist/m3/ts-generation/type-def.d.ts.map +1 -1
- package/dist/m3/ts-generation/type-def.js +1 -5
- package/dist/m3/ts-generation/type-def.js.map +1 -1
- package/dist/serialization/annotation-remover.d.ts +6 -6
- package/dist/serialization/annotation-remover.d.ts.map +1 -1
- package/dist/serialization/annotation-remover.js +3 -3
- package/dist/serialization/annotation-remover.js.map +1 -1
- package/dist/serialization/chunk.d.ts +6 -5
- package/dist/serialization/chunk.d.ts.map +1 -1
- package/dist/serialization/chunk.js +6 -6
- package/dist/serialization/chunk.js.map +1 -1
- package/dist/serialization/measurer.d.ts +8 -3
- package/dist/serialization/measurer.d.ts.map +1 -1
- package/dist/serialization/measurer.js +24 -18
- package/dist/serialization/measurer.js.map +1 -1
- package/dist/serialization/metric-types.d.ts +3 -2
- package/dist/serialization/metric-types.d.ts.map +1 -1
- package/dist/serialization/ordering.d.ts +6 -6
- package/dist/serialization/ordering.d.ts.map +1 -1
- package/dist/serialization/ordering.js +3 -3
- package/dist/serialization/ordering.js.map +1 -1
- package/dist/serialization/sorting.d.ts +2 -2
- package/dist/serialization/sorting.d.ts.map +1 -1
- package/dist/serialization/sorting.js +4 -5
- package/dist/serialization/sorting.js.map +1 -1
- package/dist/serialization/textualizer.d.ts +3 -2
- package/dist/serialization/textualizer.d.ts.map +1 -1
- package/dist/serialization/textualizer.js +12 -11
- package/dist/serialization/textualizer.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/package.json +12 -8
- package/dist/utils/array.d.ts +0 -9
- package/dist/utils/array.d.ts.map +0 -1
- package/dist/utils/array.js +0 -9
- package/dist/utils/array.js.map +0 -1
- package/dist/utils/nested-map.d.ts +0 -46
- package/dist/utils/nested-map.d.ts.map +0 -1
- package/dist/utils/nested-map.js +0 -50
- package/dist/utils/nested-map.js.map +0 -1
- package/dist/utils/object.d.ts +0 -5
- package/dist/utils/object.d.ts.map +0 -1
- package/dist/utils/object.js +0 -5
- package/dist/utils/object.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionweb/utilities",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-alpha.2",
|
|
4
4
|
"description": "LionWeb utilities",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,18 +15,22 @@
|
|
|
15
15
|
"url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@lionweb/core": "0.
|
|
18
|
+
"@lionweb/core": "0.7.0-alpha.2",
|
|
19
|
+
"@lionweb/json": "0.7.0-alpha.2",
|
|
20
|
+
"@lionweb/ts-utils": "0.7.0-alpha.2",
|
|
19
21
|
"littoral-templates": "0.3.0",
|
|
20
22
|
"nanoid": "5.0.9"
|
|
21
23
|
},
|
|
22
24
|
"scripts": {
|
|
23
|
-
"clean": "rm -rf dist/ lionweb-utilities-*.tgz",
|
|
25
|
+
"clean": "rm -rf dist/ node_modules/ lionweb-utilities-*.tgz",
|
|
24
26
|
"build": "tsc",
|
|
25
27
|
"lint": "eslint src",
|
|
26
|
-
"pre-release
|
|
27
|
-
"prerelease": "npm run pre-release
|
|
28
|
-
"release": "npm publish",
|
|
29
|
-
"prerelease-beta": "npm run pre-release
|
|
30
|
-
"release-beta": "npm publish --tag beta"
|
|
28
|
+
"prep:pre-release": "npm run clean && npm install && npm run build",
|
|
29
|
+
"prerelease-alpha": "npm run prep:pre-release",
|
|
30
|
+
"release-alpha": "npm publish --tag alpha",
|
|
31
|
+
"prerelease-beta": "npm run prep:pre-release",
|
|
32
|
+
"release-beta": "npm publish --tag beta",
|
|
33
|
+
"prerelease": "npm run prep:pre-release",
|
|
34
|
+
"release": "npm publish"
|
|
31
35
|
}
|
|
32
36
|
}
|
package/dist/utils/array.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sum the given array of numbers.
|
|
3
|
-
*/
|
|
4
|
-
export declare const sumNumbers: (nums: number[]) => number;
|
|
5
|
-
/**
|
|
6
|
-
* @return a view of the given array of items with duplicates removed.
|
|
7
|
-
*/
|
|
8
|
-
export declare const uniquesAmong: <T>(ts: T[]) => T[];
|
|
9
|
-
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/utils/array.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,EAAE,KAAG,MACD,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,YAAY,qBACL,CAAA"}
|
package/dist/utils/array.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sum the given array of numbers.
|
|
3
|
-
*/
|
|
4
|
-
export const sumNumbers = (nums) => nums.reduce((acc, cur) => acc + cur, 0);
|
|
5
|
-
/**
|
|
6
|
-
* @return a view of the given array of items with duplicates removed.
|
|
7
|
-
*/
|
|
8
|
-
export const uniquesAmong = (ts) => [...new Set(ts)];
|
|
9
|
-
//# sourceMappingURL=array.js.map
|
package/dist/utils/array.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/utils/array.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAc,EAAU,EAAE,CACjD,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC,CAAC,CAAA;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,EAAO,EAAO,EAAE,CAC5C,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type Nested1Map<T> = Record<string, T>;
|
|
2
|
-
export type Nested2Map<T> = Record<string, Record<string, T>>;
|
|
3
|
-
export type Nested3Map<T> = Record<string, Record<string, Record<string, T>>>;
|
|
4
|
-
export declare const mapValuesMapper: <T, R>(valueMapFunc: (t: T) => R) => (map: Record<string, T>) => Record<string, R>;
|
|
5
|
-
export declare const nested2Mapper: <T, R>(valueMapFunc: (t: T) => R) => (map: Record<string, Record<string, T>>) => Record<string, Record<string, R>>;
|
|
6
|
-
export declare const nested3Mapper: <T, R>(valueMapFunc: (t: T) => R) => (map: Record<string, Record<string, Record<string, T>>>) => Record<string, Record<string, Record<string, R>>>;
|
|
7
|
-
/**
|
|
8
|
-
* Return a function that groups an array of things using a group function as a
|
|
9
|
-
* map : string (group key) → array of grouped things.
|
|
10
|
-
*/
|
|
11
|
-
export declare const grouper: <T>(key1Func: (t: T) => string) => (ts: T[]) => Nested1Map<T[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Return a function that groups an array of things using two group functions as a nested map
|
|
14
|
-
* map : string (group key 1) →
|
|
15
|
-
* map : string (group key 2) → array of grouped things.
|
|
16
|
-
*/
|
|
17
|
-
export declare const nested2Grouper: <T>(key1Func: (t: T) => string, key2Func: (t: T) => string) => (ts: T[]) => Nested2Map<T[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Return a function that groups an array of things using two group functions as a nested map
|
|
20
|
-
* map : string (group key 1) →
|
|
21
|
-
* map : string (group key 2) →
|
|
22
|
-
* map : string (group key 3) → array of grouped things.
|
|
23
|
-
*/
|
|
24
|
-
export declare const nested3Grouper: <T>(key1Func: (t: T) => string, key2Func: (t: T) => string, key3Func: (t: T) => string) => (ts: T[]) => Nested3Map<T[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Flat-maps over the values of a
|
|
27
|
-
* map : string (group key) → values
|
|
28
|
-
* using the map function, which is also provided with the keys.
|
|
29
|
-
*/
|
|
30
|
-
export declare const flatMapValues: <T, R>(map: Record<string, T>, mapFunc: (t: T, key1: string) => R) => R[];
|
|
31
|
-
/**
|
|
32
|
-
* Flat-maps over the values of a nested map
|
|
33
|
-
* map : string (group key 1) →
|
|
34
|
-
* map: string (group key 2) → values
|
|
35
|
-
* using the map function, which is also provided with the keys.
|
|
36
|
-
*/
|
|
37
|
-
export declare const nestedFlatMap2: <T, R>(nested2Map: Nested2Map<T>, map2Func: (t: T, key1: string, key2: string) => R) => R[];
|
|
38
|
-
/**
|
|
39
|
-
* Flat-maps over the values of a nested map
|
|
40
|
-
* map : string (group key 1) →
|
|
41
|
-
* map: string (group key 2) →
|
|
42
|
-
* map: string (group key 3) → values
|
|
43
|
-
* using the map function, which is also provided with the keys.
|
|
44
|
-
*/
|
|
45
|
-
export declare const nestedFlatMap3: <T, R>(nested3Map: Nested3Map<T>, map3Func: (t: T, key1: string, key2: string, key3: string) => R) => R[];
|
|
46
|
-
//# sourceMappingURL=nested-map.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nested-map.d.ts","sourceRoot":"","sources":["../../src/utils/nested-map.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAC7C,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;AAC7D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAG7E,eAAO,MAAM,eAAe,oFAKnB,CAAA;AAGT,eAAO,MAAM,aAAa,oHAC4B,CAAA;AAEtD,eAAO,MAAM,aAAa,oJAC0B,CAAA;AAGpD;;;GAGG;AACH,eAAO,MAAM,OAAO,0BACI,MAAM,iCAEQ,CAAA;AAEtC;;;;GAIG;AACH,eAAO,MAAM,cAAc,0BACH,MAAM,sBACN,MAAM,iCAE4C,CAAA;AAG1E;;;;;GAKG;AACH,eAAO,MAAM,cAAc,0BACH,MAAM,sBACN,MAAM,sBACN,MAAM,iCAE6D,CAAA;AAI3F;;;;GAIG;AACH,eAAO,MAAM,aAAa,uDAEA,MAAM,cAGa,CAAA;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,cAAc,2DAEA,MAAM,QAAQ,MAAM,cAKtC,CAAA;AAET;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,2DAEA,MAAM,QAAQ,MAAM,QAAQ,MAAM,cAKpD,CAAA"}
|
package/dist/utils/nested-map.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { groupBy } from "@lionweb/core";
|
|
2
|
-
export const mapValuesMapper = (valueMapFunc) => (map) => Object.fromEntries(Object.entries(map)
|
|
3
|
-
.map(([key, value]) => [key, valueMapFunc(value)]));
|
|
4
|
-
// === mapValues(map, valueFunc)
|
|
5
|
-
export const nested2Mapper = (valueMapFunc) => mapValuesMapper(mapValuesMapper(valueMapFunc));
|
|
6
|
-
export const nested3Mapper = (valueMapFunc) => mapValuesMapper(nested2Mapper(valueMapFunc));
|
|
7
|
-
/**
|
|
8
|
-
* Return a function that groups an array of things using a group function as a
|
|
9
|
-
* map : string (group key) → array of grouped things.
|
|
10
|
-
*/
|
|
11
|
-
export const grouper = (key1Func) => (ts) => groupBy(ts, key1Func);
|
|
12
|
-
/**
|
|
13
|
-
* Return a function that groups an array of things using two group functions as a nested map
|
|
14
|
-
* map : string (group key 1) →
|
|
15
|
-
* map : string (group key 2) → array of grouped things.
|
|
16
|
-
*/
|
|
17
|
-
export const nested2Grouper = (key1Func, key2Func) => (ts) => mapValuesMapper(grouper(key2Func))(grouper(key1Func)(ts));
|
|
18
|
-
// === mapValuesMapper((vs) => groupBy(vs, key2Func))(groupBy(ts, key1Func))
|
|
19
|
-
/**
|
|
20
|
-
* Return a function that groups an array of things using two group functions as a nested map
|
|
21
|
-
* map : string (group key 1) →
|
|
22
|
-
* map : string (group key 2) →
|
|
23
|
-
* map : string (group key 3) → array of grouped things.
|
|
24
|
-
*/
|
|
25
|
-
export const nested3Grouper = (key1Func, key2Func, key3Func) => (ts) => mapValuesMapper(nested2Grouper(key2Func, key3Func))(grouper(key1Func)(ts));
|
|
26
|
-
/**
|
|
27
|
-
* Flat-maps over the values of a
|
|
28
|
-
* map : string (group key) → values
|
|
29
|
-
* using the map function, which is also provided with the keys.
|
|
30
|
-
*/
|
|
31
|
-
export const flatMapValues = (map, mapFunc) => Object.entries(map)
|
|
32
|
-
.map(([key1, t]) => mapFunc(t, key1));
|
|
33
|
-
/**
|
|
34
|
-
* Flat-maps over the values of a nested map
|
|
35
|
-
* map : string (group key 1) →
|
|
36
|
-
* map: string (group key 2) → values
|
|
37
|
-
* using the map function, which is also provided with the keys.
|
|
38
|
-
*/
|
|
39
|
-
export const nestedFlatMap2 = (nested2Map, map2Func) => Object.entries(nested2Map)
|
|
40
|
-
.flatMap(([key1, nestedMap1]) => flatMapValues(nestedMap1, (t, key2) => map2Func(t, key1, key2)));
|
|
41
|
-
/**
|
|
42
|
-
* Flat-maps over the values of a nested map
|
|
43
|
-
* map : string (group key 1) →
|
|
44
|
-
* map: string (group key 2) →
|
|
45
|
-
* map: string (group key 3) → values
|
|
46
|
-
* using the map function, which is also provided with the keys.
|
|
47
|
-
*/
|
|
48
|
-
export const nestedFlatMap3 = (nested3Map, map3Func) => Object.entries(nested3Map)
|
|
49
|
-
.flatMap(([key1, nestedMap2]) => nestedFlatMap2(nestedMap2, (t, key2, key3) => map3Func(t, key1, key2, key3)));
|
|
50
|
-
//# sourceMappingURL=nested-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nested-map.js","sourceRoot":"","sources":["../../src/utils/nested-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAA;AAQrC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAO,YAAyB,EAAE,EAAE,CAC/D,CAAC,GAAsB,EAAqB,EAAE,CAC1C,MAAM,CAAC,WAAW,CACd,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;KACd,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CACzD,CAAA;AACT,gCAAgC;AAEhC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAO,YAAyB,EAAE,EAAE,CACzD,eAAe,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAA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EAAE,CAC5B,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAClE,CAAA;AAET;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,UAAyB,EACzB,QAA+D,EAC5D,EAAE,CACL,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;KACrB,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,CAC5B,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAC/E,CAAA"}
|
package/dist/utils/object.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,MAAM,kDACC,CAAA"}
|
package/dist/utils/object.js
DELETED
package/dist/utils/object.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAuB,GAAM,EAAkB,EAAE,CACnE,CAAC,CAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|