Use start-of-string matching to avoid ambiguity between preact and react

This commit is contained in:
Klemen Slavič 2022-12-27 16:30:08 +01:00
parent 06315ddaf2
commit 01c0eed0b8

View File

@ -26,12 +26,13 @@ export const reproNext = async ({
branch,
init,
}: ReproOptions) => {
const filterRegex = new RegExp(`^${filterValue || ''}`, 'i');
const keys = Object.keys(TEMPLATES) as Choice[];
// get value from template and reduce through TEMPLATES to filter out the correct template
const choices = keys.reduce<Choice[]>((acc, group) => {
const current = TEMPLATES[group];
const filterRegex = new RegExp(filterValue, 'i');
if (!filterValue) {
acc.push(group);
return acc;