• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript node-uuid.v4函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中node-uuid.v4函数的典型用法代码示例。如果您正苦于以下问题:TypeScript v4函数的具体用法?TypeScript v4怎么用?TypeScript v4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了v4函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: it

  it('unparse', () => {
    const buffer: Buffer = v4(null, new Buffer(''));
    const array: number[] = v4(null, []);

    const unparsed1: string = unparse(buffer);
    expect(unparsed1).to.be.a('string');

    const unparsed2: string = unparse(array);
    expect(unparsed2).to.be.a('string');
  });
开发者ID:goodmind,项目名称:typed-node-uuid,代码行数:10,代码来源:index.ts


示例2: it

  it('should be able to destroy an instance with pubsub listeners', async () => {
    const exchangeName = v4() + '.test';
    const queueName = v4() + '.test';

    const rabbit = new Rabbitr({
      url: process.env.RABBITMQ_URL || 'amqp://guest:guest@localhost/%2F',
    });

    rabbit.subscribe([exchangeName], queueName, {}, ({ack}) => ack());

    await wait(200);

    await rabbit.destroy();
  });
开发者ID:urbanmassage,项目名称:node-rabbitr,代码行数:14,代码来源:destroy.ts


示例3: process_device_add

function process_device_add(client, msg) {
  if (client.flags.authenticated) {
    let device = {
      id: uuid.v4(),
      device_id: uuid.v4(),
      created_at: new Date().toISOString(),
      name: msg.params.name,
      user_id: client.flags.authenticated.user_id
    }
    db.device_add(device)
    protocol.respond_success(client, msg.id, {id: device.id})
  } else {
    protocol.respond_fail(client, msg.id, { message: "Not authenticated" })
  }
}
开发者ID:icecondor,项目名称:api,代码行数:15,代码来源:api.ts


示例4: it

  it('should not receive a message if #clearTimer is called', () => {
    const DELAY = 50;

    const queueName = v4() + '.clear_timer_test';

    const testData = {
      testProp: 'timed-example-data-' + queueName
    };

    let receivedMessages = 0;

    rabbit.subscribe([queueName], queueName, {}, (message) => {
      message.ack();

      receivedMessages++;
    })
      .then(() => createdQueues.push(queueName))
      .then(() =>
        createdExchanges.push(queueName)
      );

    // set the timer and schedule the clear
    rabbit.setTimer(queueName, 'unique_clearing_test_id', testData, DELAY);
    setTimeout(function() {
      rabbit.clearTimer(queueName, 'unique_clearing_test_id');
    }, DELAY / 2);

    // also set a timeout to fire after the message should have already have been delivered to check it wasn't
    return wait(DELAY)
      .then(() => {
        expect(receivedMessages).to.equal(0);
      });
  });
开发者ID:urbanmassage,项目名称:node-rabbitr,代码行数:33,代码来源:timer.ts


示例5: it

        it('Should Add devices', (done) => {

            var deviceId = uuid.v4();
            var expected = { 
                deviceId: deviceId,
                authentication: { 
                    symmetricKey: {
                        primaryKey: 'primKey' 
                    }
                } 
            };

            request.body = expected;

            response.json.and.callFake(function (actual) {
                expect(actual.deviceId).toEqual(expected.deviceId);
                done();
            });

            spyOn(this.deviceAPI.registry, 'create').and.callFake(function (device, callback) {
                callback(null, expected);
            });

            this.deviceAPI.AddDevice(request, response, function (error, res) {
                let correctConnString = `${this.deviceApi.host};DeviceId=${deviceId};SharedAccessKey=${expected.authentication.symmetricKey.primaryKey}`;
                expect(res['_deviceConnectionString']).toEqual(correctConnString);
                done.fail(error);
            });

        });
开发者ID:habukira,项目名称:Azure-azure-iot-device-management,代码行数:30,代码来源:deviceAPI.spec.ts


示例6: it

  it("check", async () => {
    let uuid = Uuid.v4().toString();
    let wc = config.Certor.create(param([], uuid))
    let etcd = await wc.etcd();
    let domains = [new DomainKsk(), new DomainZsk()]
    for (let i in domains) {
      let df = domains[i] 
      assert.deepEqual(true, (await df.start(param(['get'], uuid), etcd)).isErr(), "get-zsk not set")

      assert.deepEqual(true, (await df.start(param(['get', '--domain', 'test'], uuid), etcd)).isErr(), "get-zsk not set")

      assert.deepEqual(true, (await df.start(param(['set', 'zsk'], uuid), etcd)).isErr(), "add without domain()")

      assert.deepEqual("zsk", (await df.start(param(['set', 'zsk', '--domain', 'test'], uuid), etcd)).ok.asJson(), "add without domain()")

      let zsk_fname = `.zsk.test.${uuid}`
      fs.writeFileSync(zsk_fname, "zsk-file")
      assert.deepEqual("zsk-file", (await df.start(param(['set', `@${zsk_fname}`, '--domain', 'test'], uuid), etcd)).ok.asJson(), "add without domain()")

      fs.unlinkSync(zsk_fname)

      assert.deepEqual("zsk-file", (await df.start(param(['get', '--domain', 'test'], uuid), etcd)).ok.asJson(), "add without domain()")

      assert.deepEqual("zsk-file", (await df.start(param(['del', '--domain', 'test'], uuid), etcd)).ok.asJson(), "add without domain()")

      assert.deepEqual(true, (await df.start(param(['get', '--domain', 'test'], uuid), etcd)).isErr(), "add without domain()")
    }
  })
开发者ID:protonet,项目名称:certor,代码行数:28,代码来源:domain-keys-test.ts



注:本文中的node-uuid.v4函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript node-wit.Wit类代码示例发布时间:2022-05-25
下一篇:
TypeScript node-uuid.v1函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap