Wrap a function within the confines of a domain using the simple callback form you know and love.

Usage no npm install needed!

<script type="module">
  import domainit from '';


domainit - wrap a function in the safety of a domain

Wrap a function with the warm comfort of a node domain using standard callbacks.

var assert = require('assert');
var domainit = require('domainit');

function unsafe(cb) {
  process.nextTick(function () {
    throw new Error('Oops!');

var safe = domainit(unsafe);
safe(function (err) {
  assert(err.message === 'Oops!');