Code quality checks
This commit is contained in:
@@ -186,9 +186,9 @@ function fillTemplate(pattern: string): string {
|
||||
|
||||
function applyParenthesizationRandomization(formula: string): string {
|
||||
if (Math.random() < 0.2) {
|
||||
const operators = formula.match(/[\+\-\*\/\&\|\^]/g)
|
||||
const operators = formula.match(/[+\-*/&|^]/g)
|
||||
if (operators && operators.length > 0) {
|
||||
const parts = formula.split(/([+\-*\/&|^])/)
|
||||
const parts = formula.split(/([+\-*/&|^])/)
|
||||
if (parts.length >= 3) {
|
||||
const idx = Math.floor(Math.random() * (parts.length - 2) / 2) * 2
|
||||
parts[idx] = `(${parts[idx]})`
|
||||
|
||||
@@ -28,16 +28,16 @@ export function createTileStateFromCurrent(formula: string): TileState {
|
||||
|
||||
export function loadTileParams(tile: TileState): void {
|
||||
Object.entries(tile.engineParams).forEach(([key, value]) => {
|
||||
engineSettings.setKey(key as any, value)
|
||||
engineSettings.setKey(key as keyof ReturnType<typeof getDefaultEngineValues>, value)
|
||||
})
|
||||
|
||||
Object.entries(tile.effectParams).forEach(([key, value]) => {
|
||||
effectSettings.setKey(key as any, value as any)
|
||||
effectSettings.setKey(key as never, value as never)
|
||||
})
|
||||
|
||||
if (tile.lfoConfigs) {
|
||||
Object.entries(tile.lfoConfigs).forEach(([key, value]) => {
|
||||
lfoSettings.setKey(key as any, value)
|
||||
lfoSettings.setKey(key as keyof LFOSettings, value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export function generateWaveformData(formula: string, width: number, sampleRate:
|
||||
}
|
||||
|
||||
return waveform
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return Array(width * 2).fill(0)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user