How to use the pm2-axon/lib/utils.slice function in pm2-axon

To help you get started, we’ve selected a few pm2-axon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jitta / spinal / lib / patch.js View on Github external
function reply() {
      var fn = function(){};
      var args = slice(arguments);
      args[0] = args[0] || null;

      var hasCallback = 'function' == typeof args[args.length - 1];
      if (hasCallback) fn = args.pop();

      args.push(id);

      if (sock.writable) {
        sock.write(self.pack(args), function(){ fn(true) });
        return true;
      } else {
        debug('peer went away');
        process.nextTick(function(){ fn(false) });
        return false;
      }
    }

pm2-axon

High-level messaging & socket patterns implemented in pure js

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis