@akromio/peval
v0.7.1
Published
Protected evaluation lib.
Downloads
43
Readme
@akromio/peval
A helper function to run a function and to return an array with two elements:
The first indicating if the call ended ok: true or false.
The second indicating the value returned or the error raised.
Product of Spain, made in Valencia by Sia Codelabs.
Use
import peval from "@akromio/peval"
// ...
const [ok, value] = peval(() => fun(1, 2, 3))
if (ok) {
// value contains the value returned by the call
} else {
// value contains the error raised
}