Created
April 13, 2021 16:11
-
-
Save paulshen/9889b6067609f9053a0d56d464164cad to your computer and use it in GitHub Desktop.
natto.dev eval pseudocode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const f = useMemo(() => { | |
try { | |
return new Function('inputs', `return ${expression}`); | |
} catch (e) { | |
return [e]; | |
} | |
}, [expresssion]); | |
// input atoms | |
useEffect(() => { | |
try { | |
setOutput(f(inputs)); | |
} catch {} | |
}, [inputs]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment