eval.function
v1.0.1
Published
Eval function in browser
Downloads
3
Readme
eval.function
Eval function in browser
JS
const evalFunction = require('eval.function');
const fn = await evalFunction(`
function(name) { return 'hello ' + name }
`);
console.log(fn('user')) // hello user
HTML
<script src="https://unpkg.com/eval.function/eval.function.js"></script>
<script>
(async () => {
const evalFunction = window.EvalFunction;
const fn = await evalFunction(`
function(name) { return 'hello ' + name }
`);
console.log(fn('user')) // hello user
})();
</script>