logo

rcp

The rcp functions stands for return custom promise. It takes a function and a value and returns a promise that resolves to the value.

import { rcp } from '@aracna/core';

(async () => {
  async function add(a, b) {
    return a + b;
  }

  // will log 0
  console.log(await rcp(() => add(1, 2), 0));
})();