From a3df8ca5126a7699ea3904a4f5eb98f082f9b3d3 Mon Sep 17 00:00:00 2001 From: Namide Date: Fri, 11 Oct 2024 16:25:35 +0200 Subject: [PATCH] Improve worker function parse --- src/worker.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/worker.ts b/src/worker.ts index 97e1452..1dfb540 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -205,7 +205,12 @@ onmessage = (message) => { ] = message.data as Parameters; extractColors( picture, - [_pixels, _distance, eval(`(${_colorValidatorStr})`), ..._cleanInputsRest], + [ + _pixels, + _distance, + Function(`return ${_colorValidatorStr}`)(), + ..._cleanInputsRest, + ], postMessage ); };