Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma strängvärde byggs med konkatenering i stället för att matcha mönstret.
23 lines
863 B
TypeScript
23 lines
863 B
TypeScript
/**
|
|
* Split the search string an account picker was showing when the user reached
|
|
* for "Skapa konto" into AddAccountDialog's two prefill props.
|
|
*
|
|
* The combobox hands over whatever was typed, which is either a partial/full
|
|
* account number ("8022") or a name fragment ("andelar i dotterföretag").
|
|
* Feeding a name into initialAccountNumber would be silently dropped by the
|
|
* dialog's digits-only filter, and feeding a number into initialAccountName
|
|
* would put "8022" in the name field.
|
|
*/
|
|
export interface CreateAccountPrefill {
|
|
initialAccountNumber?: string
|
|
initialAccountName?: string
|
|
}
|
|
|
|
export function splitCreateAccountPrefill(prefill: string): CreateAccountPrefill {
|
|
const trimmed = prefill.trim()
|
|
if (!trimmed) return {}
|
|
return /^\d{1,4}$/.test(trimmed)
|
|
? { initialAccountNumber: trimmed }
|
|
: { initialAccountName: trimmed }
|
|
}
|