Skip to content

Commit 3429e9c

Browse files
committed
Minor changes
1 parent 37adef5 commit 3429e9c

File tree

1 file changed

+5
-5
lines changed
  • packages/nimble-components/src/utilities/tests

1 file changed

+5
-5
lines changed

packages/nimble-components/src/utilities/tests/matrix.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const sharedMatrixParameters = () => ({
2525
}) as const;
2626

2727
type MakeTupleEntriesArrays<T> = { [K in keyof T]: readonly T[K][] };
28+
2829
/**
2930
* Calculates the cartesian product of an array of sets.
3031
*/
@@ -50,23 +51,22 @@ export function cartesianProduct<T extends readonly unknown[]>(
5051
}
5152

5253
/**
53-
* Takes a template rendered with an array of states.
54+
* Passes each of the given state combinations into a template function and returns the combined output.
5455
*/
5556
function createMatrixFromStates<T extends readonly unknown[]>(
5657
component: (...states: T) => ViewTemplate,
5758
states: T[]
5859
): ViewTemplate {
59-
const matrix = states.map(state => component(...state));
6060
// prettier-ignore
6161
return html`
62-
${repeat(() => matrix, html`
63-
${(x: ViewTemplate): ViewTemplate => x}
62+
${repeat(() => states, html`
63+
${(x: T): ViewTemplate => component(...x)}
6464
`)}
6565
`;
6666
}
6767

6868
/**
69-
* Takes a template rendered with the cartesian product the provided states.
69+
* Creates a template that renders all combinations of states in the given dimensions.
7070
*/
7171
export function createMatrix<T extends readonly unknown[]>(
7272
component: (...states: T) => ViewTemplate,

0 commit comments

Comments
 (0)