JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q38642F

Protected evaluation lib.

Package Exports

  • @akromio/peval
  • @akromio/peval/dist/cjs/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@akromio/peval) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@akromio/peval

NPM version Total downloads

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
}