@loadsmart/miranda-wc 2.1.0 → 2.1.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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ElementType<A> = A extends ReadonlyArray<infer T> ? T : never;
|
|
2
|
+
type ElementsOfAll<Inputs, R extends ReadonlyArray<unknown> = []> = Inputs extends readonly [infer F, ...infer M] ? ElementsOfAll<M, [...R, ElementType<F>]> : R;
|
|
3
|
+
type CartesianProduct<Inputs> = ElementsOfAll<Inputs>[];
|
|
4
|
+
/**
|
|
5
|
+
* Returns the cartesian product of one or more iterables.
|
|
6
|
+
*
|
|
7
|
+
* Based on https://stackoverflow.com/a/72059390
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* Consider the standard playing card ranks and its suits:
|
|
11
|
+
* cartesianProduct([A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2], [♠, ♥, ♦, ♣]);
|
|
12
|
+
* The product of these iterables would be [[A, ♠], [A, ♥]...] and so on until we have all 52 cards.
|
|
13
|
+
*/
|
|
14
|
+
export declare const cartesianProduct: <Sets extends readonly (readonly unknown[])[]>(...sets: Sets) => CartesianProduct<Sets>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cartesianProduct } from './cartesian-product';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loadsmart/miranda-wc",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Miranda Web Components component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@floating-ui/dom": "^1.6.3",
|
|
48
48
|
"@lit/context": "^1.1.1",
|
|
49
|
-
"@loadsmart/miranda-icons": "2.1.
|
|
50
|
-
"@loadsmart/miranda-tokens": "3.1.
|
|
49
|
+
"@loadsmart/miranda-icons": "2.1.1",
|
|
50
|
+
"@loadsmart/miranda-tokens": "3.1.1",
|
|
51
51
|
"autosize": "^6.0.1",
|
|
52
52
|
"composed-offset-position": "^0.0.4",
|
|
53
53
|
"lit": "^3.1.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './product';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the cartesian product of one or more iterables.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* Consider the standard playing card ranks and its suits:
|
|
6
|
-
* product([A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2], [♠, ♥, ♦, ♣]);
|
|
7
|
-
* The product of these iterables would be [[A, ♠], [A, ♥]...] and so on until we have all 52 cards.
|
|
8
|
-
*
|
|
9
|
-
* @template T
|
|
10
|
-
* @param {...T[][]} args
|
|
11
|
-
* @returns {T[][]}
|
|
12
|
-
*/
|
|
13
|
-
declare const product: <T>(...args: T[][]) => T[][];
|
|
14
|
-
export default product;
|