How to use the uuidjs.genV4 function in uuidjs

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 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,
  };
}
github wireapp / wire-webapp / test / unit_tests / components / messageSpec.js View on Github external
        selfId: () => UUID.genV4().hexString,
        shouldShowAvatar: true,
github wireapp / wire-webapp / src / script / util / util.ts View on Github external
export const createRandomUuid = (): string => UUID.genV4().hexString;
github wireapp / wire-webapp / src / script / components / infoToggle.js View on Github external
constructor(params) {
    this.dataUieNameInfoText = `status-info-toggle-${params.dataUieName}`;
    this.dataUieNameLabelText = `do-toggle-${params.dataUieName}`;
    this.info = params.info;
    this.inputId = UUID.genV4();
    this.isChecked = params.isChecked;
    this.isDisabled = params.isDisabled;
    this.name = params.name;
  }
}
github aarondcohen / id128 / benchmark / competitors.js View on Github external
bench('UuidJs v4 Canonical', function() {
		UuidJs.genV4().toString();
	});
});

uuidjs

RFC-compliant UUID Generator for JavaScript

Apache-2.0
Latest version published 1 year ago

Package Health Score

51 / 100
Full package analysis