How to use node-uuid - 10 common examples

To help you get started, we’ve selected a few node-uuid 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 PacktPublishing / Node.js_Design_Patterns_Second_Edition_Code / ch11 / 07_correlation_id / request.js View on Github external
return function sendRequest(req, callback) {  // [3]
    const correlationId = uuid.v4();
    idToCallbackMap[correlationId] = callback;
    channel.send({
      type: 'request',
      data: req,
      id: correlationId
    });
  };
};
github HubPress / hubpress.io / src / hubpress / scripts / services / PostsServices.js View on Github external
.then((postDb) => {
      let _post = null;

      postDb = postDb || {id: uuid.v4()};

      // Test on sha is not enough because a post can be published/unpublished
      // and the sha on the post does not change
      //if (postDb.sha !== postGithub.sha) {
        _post = assign({}, postGithub, postDb);
      //}

      deferred.resolve(_post)
    })
    .catch((err) => {
github googleapis / google-cloud-node / test / common / stream-router.js View on Github external
it('should maintain `this` context', function(done) {
      FakeClass.prototype.methodToExtend = function() { return this.uuid; };

      var cls = new FakeClass();
      cls.uuid = uuid.v1();

      overrides.streamRouter.router_ = function(args, originalMethod) {
        assert.equal(originalMethod(), cls.uuid);
        done();
      };

      streamRouter.extend(FakeClass, 'methodToExtend');
      cls.methodToExtend();
    });
github walmartlabs / little-loader / test / func / spec / base.spec.js View on Github external
cfg.reporting.reportConfig = function () {
      return {
        json: {
          file: "coverage-" + uuid.v4() + ".json"
        }
      };
    };
github egonz / action-at-a-distance / server / actionatadistance.js View on Github external
socket.on('init', function (data) {
			console.log('New ActionAtADistance Socket.io connection.');
			socket.uuid = nodeUuid.v4();
			//Add the sockUser to the list of socket connections
			addSockUser(socket);
        });
github pubnub / pubnub-api / games / stackhack / server.js View on Github external
app.get('/', function(req, res) {

  console.log('/');
  var new_client = addClient(uuid.v4()),
      block_array = objectToArray(block_index);

  console.log(block_array);
  res.render('main', {'debug': debug,
                      'layout': true, 
                      'uuid':   new_client.info.uuid,
                      'time_til_wipe':   getTimeTilWipe(),
                      'block_array': block_array });
});
github yldio / training-node-angular-source-code / sessions.js View on Github external
function createSession(user, cb) {
  var sessionId = uuid();
  var key = prefix + sessionId;
  client.multi()
    .set(key, JSON.stringify(user))
    .expire(key, ttl_secs)
    .exec(function(err) {
      cb(err, sessionId);
    });
};
github PacktPublishing / Node.js_Design_Patterns_Second_Edition_Code / ch11 / 08_return_address / amqpRequest.js View on Github external
request(queue, message, callback) {
    const id = uuid.v4();
    this.idToCallbackMap[id] = callback;
    this.channel.sendToQueue(queue,
      new Buffer(JSON.stringify(message)),
      {correlationId: id, replyTo: this.replyQueue}
    );
  }
}
github broidHQ / integrations / broid-discord / src / core / Adapter.ts View on Github external
constructor(obj?: IAdapterOptions) {
    this.serviceID = obj && obj.serviceID || uuid.v4();
    this.logLevel = obj && obj.logLevel || 'info';
    this.token = obj && obj.token || null;

    this.session = new Discordie({
      autoReconnect: true,
    });
    this.parser = new Parser(this.serviceName(), this.serviceID, this.logLevel);
    this.logger = new Logger('adapter', this.logLevel);
  }
github broidHQ / integrations / broid-discord / lib / core / Adapter.js View on Github external
constructor(obj) {
        this.serviceID = obj && obj.serviceID || uuid.v4();
        this.logLevel = obj && obj.logLevel || 'info';
        this.token = obj && obj.token || null;
        this.session = new Discordie({
            autoReconnect: true,
        });
        this.parser = new Parser_1.Parser(this.serviceName(), this.serviceID, this.logLevel);
        this.logger = new utils_1.Logger('adapter', this.logLevel);
    }
    users() {

node-uuid

Rigorous implementation of RFC4122 (v1 and v4) UUIDs.

MIT
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis

Popular node-uuid functions