2
0
Files
bot/packages/variables/findUniqueVariableValue.ts
Baptiste Arnaud d51cf00f69 💄 Fix audio element UI overflow on Firefox
Also added better display when a media bubble src is a variable

Closes #1742
2024-09-02 11:47:02 +02:00

13 lines
401 B
TypeScript

import { Variable } from './types'
export const findUniqueVariable =
(variables: Variable[]) =>
(value: string | undefined): Variable | null => {
if (!value || !value.startsWith('{{') || !value.endsWith('}}')) return null
const variableName = value.slice(2, -2)
const variable = variables.find(
(variable) => variable.name === variableName
)
return variable ?? null
}