How to use uuidjs - 10 common examples

To help you get started, we’ve selected a few uuidjs 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 LiosK / UUID.js / example.js View on Github external
const UUID = require("uuidjs")

// Generate UUID string
console.log(UUID.generate())

// Create UUID objects and get string representations
console.log(UUID.genV4().toString())
console.log(UUID.genV1().hexNoDelim)
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn)

// Get UUID internal field values
console.log(UUID.genV4().hexFields.node)
console.log(UUID.genV1().intFields.timeLow)
console.log(UUID.genV4().bitFields[2])

UUID.genV1()
github LiosK / UUID.js / example.js View on Github external
const UUID = require("uuidjs")

// Generate UUID string
console.log(UUID.generate())

// Create UUID objects and get string representations
console.log(UUID.genV4().toString())
console.log(UUID.genV1().hexNoDelim)
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn)

// Get UUID internal field values
console.log(UUID.genV4().hexFields.node)
console.log(UUID.genV1().intFields.timeLow)
console.log(UUID.genV4().bitFields[2])

UUID.genV1()
github LiosK / UUID.js / example.js View on Github external
const UUID = require("uuidjs")

// Generate UUID string
console.log(UUID.generate())

// Create UUID objects and get string representations
console.log(UUID.genV4().toString())
console.log(UUID.genV1().hexNoDelim)
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn)

// Get UUID internal field values
console.log(UUID.genV4().hexFields.node)
console.log(UUID.genV1().intFields.timeLow)
console.log(UUID.genV4().bitFields[2])

UUID.genV1()
github LiosK / UUID.js / example.js View on Github external
const UUID = require("uuidjs")

// Generate UUID string
console.log(UUID.generate())

// Create UUID objects and get string representations
console.log(UUID.genV4().toString())
console.log(UUID.genV1().hexNoDelim)
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn)

// Get UUID internal field values
console.log(UUID.genV4().hexFields.node)
console.log(UUID.genV1().intFields.timeLow)
console.log(UUID.genV4().bitFields[2])

UUID.genV1()
github LiosK / UUID.js / example.js View on Github external
const UUID = require("uuidjs")

// Generate UUID string
console.log(UUID.generate())

// Create UUID objects and get string representations
console.log(UUID.genV4().toString())
console.log(UUID.genV1().hexNoDelim)
console.log(UUID.parse("84d9ca79-4d66-4373-91a0-a12d673e71be").urn)

// Get UUID internal field values
console.log(UUID.genV4().hexFields.node)
console.log(UUID.genV1().intFields.timeLow)
console.log(UUID.genV4().bitFields[2])

UUID.genV1()
github wireapp / wire-webapp / test / unit_tests / components / panel / enrichedFieldsSpec.js View on Github external
it('calls the `onFieldsLoaded` function when fields are loaded', () => {
    const richProfileRepository = new RichProfileRepository(resolve(graph.BackendClient));
    const userId = UUID.genV4().hexString;
    const params = {onFieldsLoaded: () => {}, richProfileRepository, user: () => ({email: () => {}, id: userId})};
    const richProfile = {
      fields: [
        {type: 'field1', value: 'value1'},
        {type: 'field2', value: 'value2'},
      ],
    };
    spyOn(richProfileRepository, 'getUserRichProfile').and.returnValue(Promise.resolve(richProfile));
    spyOn(params, 'onFieldsLoaded');

    return instantiateComponent('enriched-fields', params).then(() => {
      expect(params.onFieldsLoaded).toHaveBeenCalledWith(richProfile.fields);
    });
  });
});
github wireapp / wire-webapp / test / unit_tests / notification / PreferenceNotificationRepositorySpec.js View on Github external
describe('PreferenceNotificationRepository', () => {
  const user = {id: UUID.genV4().hexString};
  const userObservable = () => user;

  beforeEach(() => {
    spyOn(amplify, 'store').and.callFake(() => {});
  });

  it('subscribes to preference change events', () => {
    spyOn(amplify, 'subscribe').and.callFake(() => {});

    const preferenceNotificationRepository = new PreferenceNotificationRepository(userObservable);

    expect(amplify.subscribe).toHaveBeenCalledTimes(3);
    expect(preferenceNotificationRepository.notifications().length).toBe(0);
  });

  it('adds new notification when read receipt settings are changed', () => {
github wireapp / wire-webapp / test / unit_tests / event / preprocessor / ReceiptsMiddlewareSpec.js View on Github external
describe('ReceiptsMiddleware', () => {
  const selfId = UUID.genV4();
  let readReceiptMiddleware;
  const eventService = {loadEvents: noop, replaceEvent: noop};
  const userRepository = {
    self: () => ({
      id: selfId,
    }),
  };

  beforeEach(() => {
    readReceiptMiddleware = new ReceiptsMiddleware(eventService, userRepository);
  });

  describe('processEvent', () => {
    it('ignores read receipt for which original message is not found', () => {
      const event = createConfirmationEvent(3);
github wireapp / wire-webapp / test / unit_tests / event / preprocessor / ReceiptsMiddlewareSpec.js View on Github external
function createConfirmationEvent(status, moreMessageIds = []) {
  return {
    conversation: UUID.genV4(),
    data: {
      message_id: UUID.genV4(),
      more_message_ids: moreMessageIds,
      status,
    },
    from: UUID.genV4(),
    time: '12-12-12',
    type: ClientEvent.CONVERSATION.CONFIRMATION,
  };
}
github wireapp / wire-webapp / test / unit_tests / event / preprocessor / ReceiptsMiddlewareSpec.js View on Github external
function createConfirmationEvent(status, moreMessageIds = []) {
  return {
    conversation: UUID.genV4(),
    data: {
      message_id: UUID.genV4(),
      more_message_ids: moreMessageIds,
      status,
    },
    from: UUID.genV4(),
    time: '12-12-12',
    type: ClientEvent.CONVERSATION.CONFIRMATION,
  };
}

uuidjs

RFC-compliant UUID Generator for JavaScript

Apache-2.0
Latest version published 6 months ago

Package Health Score

58 / 100
Full package analysis